Category: wordpress

  • Using AJAX in WordPress

    In the constructor of your PHP class add the following In your enqueue function add the localize script function so you have a variable to use in the js file to call admin-ajax.php Then add the callback functions to the same class Then in your js file add the following, assuming you have an element…

  • Creating a WordPress Class with Backend and Frontend functionality

    Firstly, a bare bones PHP class. Add this in it’s own file, eg mynewclass.php, and include it in functions.php Now a slightly more sophisticated one to add an admin menu item and page, with page tabs.

  • SQL to extract order report

    This SQL string will extract multiple meta values from an order.

  • WP REST with JWT

    Using the WordPress REST API with JWT authentication Step 1. Install this plugin => https://wordpress.org/plugins/advanced-access-manager/. The free version will suffice. This goes on the site you will be xtracting data from. The REST API must be enabled in the WordPress settings. Step 2. Configure the plugin and on it’s Settings tab add the Secret as…

  • WordPress Security

    This applies to self-managed Apache2 servers. Shared servers require different permissions, for example wp-config : set that file’s permissions to 440 or 400. Site Lockdown File permissions to lock down website, from the websites home folder. Do this from the root directory for example and you will break your server. Change the folder ownership of…

  • WordPress Basic Plugin

    Below is a very simple working example of a plugin. Create a directory in your plugins directory, create a php file and copy the below into it. Then from the wordpress plugins menu simply activate it. Just know that this plugin does absolutely nothing other than to show the basic setup, including public and protected…

  • Exporting/Importing Woocommerce Orders with SQL 2020

    Covers WordPress version 5.3.2 No matter how you use the SQL, be it on the command line, PhpMyAdmin or PHP, These are just the SQL commands needed. There are 4 tables invlovled not counting the variable product data. I’ll be adding that as soon as a get a free moment. wp_posts wp_postmeta wp_woocommerce_order_items wp_woocommerce_order_itemmeta wp_posts…