Articles of plugin development

Ajax function is not working on WordPress

I am creating a plugin for WordPress, I have a script that runs perfectly to part to make ajax request to write some data in the database. The code works until the part to display the text within the “ divpasso2form which is initially empty and after clicking on the text button is inserted into […]

WordPress debug messages not displaying

WordPress is not displaying any errors / debug messages, even though I double- and triple-checked every setting. In php.ini, I have error_reporting = E_ALL & ~E_NOTICE display_errors = On display_startup_errors = On log_errors = On track_errors = On In wp-config.php, I have: define(‘WP_DEBUG’, true); define(‘WP_DEBUG_LOG’, true); define(‘WP_DEBUG_DISPLAY’, true); @ini_set(‘display_errors’, 1); error_reporting(E_ALL^E_NOTICE); Still, no errors are […]

Converting core modification to a plugin

I needed to change two strings shown to the user on the site upon clicking the confirmation links in the email (not to modify the emails sent out). I made the following modifications and it worked.: — wp-activate.bak 2017-02-28 13:01:03.883175677 +0530 +++ wp-activate.php 2017-02-28 13:47:35.000000000 +0530 @@ -13,6 +13,10 @@ require( dirname(__FILE__) . ‘/wp-load.p require( […]

Search users with custom meta data

I’m looking for a way to search to make wordpress search for matches on a WC users billing-/shipping-company – but im not sure how to achive this. I found out how i can do it with the most common user fields (ID, login, email & nicename). Searching for common user data: $customers_query = new WP_User_Query( […]

Class or function wrapper for plugin code

When developing plugins, to avoid using a prefix for all functions and variables, it is common to use a wrapper for the plugin code. I have seen in many places the practice of using a class and I want to compare that to simply using a function as a wrapper. A. Class wrapper class Nice_Plugin […]

Order properties should not be accessed directly

This code: foreach ($order->meta_data as $row) { if ($row->key == ‘tid’) { $tid = $row->value; break; } } within the function function function_name($order_id, $checkout = null) { global $woocommerce; $order = new WC_Order($order_id); foreach ($order->meta_data as $row) { if ($row->key == ‘tid’) { $tid = $row->value; break; } } if (!empty($tid)) { … } } […]

Upload files to the plugin menu

I’m currently trying to build a wordpress plugin. I’d like its users to be able to add an upload file to the settings field menu of my plugin and then to be registered into the wordpress database, is there some way to do that?

Adding <div> Automatically To <table> In WordPress Using Filter Referencing?

Does anyone know how I would automatically add <div class=”table-responsive”> before every instance of a <table> on a WordPress site using filter referencing? I would also need to add a </div> to every instance of </table> as well.

Best practice for Designing a Plugin with this scenario

I have a HTML page which I wanna use inside a WordPress website. But this page should be only available to users who logged-in and non logged-in users should be redirected to login page. Since I need to check user status a PHP page should do the job and if user is logged-in it returns […]

Get content and send to 3rd party

I’ve been asked to create a WordPress plugin that will basically show a button on the “edit” and the “new” pages of the admin panel which (when clicking the button) verify an API key (which you can set in the settings) and then send the post contents to a 3rd party. When the 3rd party […]