How to…

Calling a Function from another WordPress plugin

Posted on: April 19th, 2024 by Stuart

Let’s say you have two plugins installed in WordPress and you need to run a function in PluginB from PluginA. This code will allow you to do this: Code for PluginB Here we are calling the custom action created in PluginA called plugin_a_custom_action. This code will check that PluginA is active and then get the […]

How to Blacklist an IP address and redirect them

Posted on: June 2nd, 2023 by Stuart

If your website is having a lot of traffic from an IP address and you would like to redirect them to a landing page, here is the code to do it. With this WordPress function which you can add to your functions.php file, you can add IP addresses into the array called $blocked_ips and change […]

How to Turn off HTML Form Field Autocomplete

Posted on: June 1st, 2023 by Stuart

To turn off the browser autocomplete for HTML form fields you use the command autocomplete=yes. If the field is an email field like: You can use the autocomplete=”email” too. Now that is easy, right?However, the autocomplete command is only a signal to the browsers to act on and is not guaranteed. Sometimes they just ignore […]

Creating WooCommerce Checkout Rate Limiting

Posted on: June 1st, 2023 by Stuart

If you have read another one of my posts about Stop Fake Spam WooCommerce Orders you will know how important it is to secure your Woocommerce – in fact any website platform – checkout page from bots testing their stolen credit cards.That’s right, one of the most common ways for thieves to test if their […]

Stop Fake Spam WooCommerce Orders

Posted on: May 31st, 2023 by Stuart

Have you received one or many attempts of fraudulent orders on your WooCommerce WordPress website, as one of my clients did, here are some solutions to reduce this from happening in the future. What this will do is run a function called spam_account which will compare the name. the first line in the address, phone […]

Create WooCommerce PHP Function to get the top 3 products bought at the same time from a product_id

Posted on: May 19th, 2023 by Stuart

Quite a long post title this one, if you would like a function in WordPress/WooCommerce to list the top 3 other products bought at the same time as a supplied product_id here is the code. I am using MySQL join commands to connect up the following three tables:postswoocommerce_order_itemswoocommerce_order_itemmeta Here is the function to add to […]

Remove All Add to Cart Buttons in WooCommerce

Posted on: April 18th, 2023 by Stuart

A client of mine required a button that would remove all Add to Cart buttons throughout the site from a single click. They used this for temporarily stopping purchases if their prices needed changing.This is particularly handy for emergencies! You might need a button to do this for many reasons, but it is not needed […]

Stopping a WordPress Plugin from updating

Posted on: April 17th, 2023 by Stuart

To stop a WordPress plugin from asking to be updated you need to add the following code in your functions.php file. It is very easy to do and shouldn’t take long at all.The main filename of a plugin is often the same as the folder name. This really only should be used if you REALLY […]

Creating WordPress Custom Fields

Posted on: April 17th, 2023 by Stuart

Sometimes you need to add some extra functionality to the backend of WordPress, whether to add a button in the main Dashboard page, an extra menu option in the main sidebar menu or even a whole new section in there. When I tried looking for a solution to add a button on the Dashboard page […]

How to fix PHP8 fatal error for WordPress Plugins or Functions.php

Posted on: March 6th, 2023 by Stuart

If you are like me and after upgrading your PHP to version 8 you started receiving the following error, then you are in the right place to fix it. You might as well have received a code 500 in your browser from this error also. This error signifies that there is most likely a hook […]