Articles of plugin development

Convert Custom Table Data Based Plugin To Be Searchable

I’ve got a client with some very specific requirements for a feature on their WP site for a downloads system. After a lot of scouring of the web I’ve found an old plugin and made a few changes to improve the styling and visual output. The plugin now does 90% of what is needed. However, […]

Resize Image without cropping

Currently I’m working on a WordPress plugin and as part of it users can upload Images. What I want to do is that these uploaded images of any size will be resized to 100px by 100px without cropping. Here’s the part of the code where the resizing is done. It works but, but not without […]

How to avoid conflicts with db.php / $wpdb and other plugins that decide to use them?

Our plugin (VersionPress) needs to track database changes so that it can version-control them. We currently do this by creating db.php and overriding the $wpdb instance in it but it has an issue that if any other plugin decides to override db.php there will be a conflict. My question is rather generic: to me, it […]

How do I debug an error that a plugin is causing?

I’m having an issue debugging why the plugin I’m creating keeps displaying the error You need to upgrade your database as soon as possible…. The work I’ve done so far has been on a remote dev site, and everything seems to work fine there – with no errors at all. I decided to test what […]

Get author posts count after excluding a category

I want to display the posts count of each author, but posts that are in some categories should be excluded from the count. I tried doing this with count_user_posts( $user->ID ), but this function doesn’t have any category excluding options. My second approach was to do this by querying the posts table with mySQL’s COUNT […]

Adding an external stylesheet to a plugin

I apologize in advance if this question has been asked before. I’ve created a plugin, and I’m trying to add an external stylesheet, but it’s not working. Am I suppose to compress the plugin file and the stylesheet, and upload them then add a link to the stylesheet in the theme’s php file?

Second select list values are not saved after clicking update

I have a select list in a metabox which value is saved successfully after clicking “Update” when editing post. Of course, the values are custom taxonomies. But i don’t know how to add another select list and make it save its values successfully too… add_action( ‘add_meta_boxes’, ‘so_custom_meta_box’ ); function so_custom_meta_box($post){ add_meta_box(‘so_meta_box’, ‘Reproductor 1’, ‘custom_element_grid_class_meta_box’, $post->post_type, […]

Calling a class method instantiated by ajax call in wordpress

I have an ajax call in WordPress that instantiate a class. I want to be able to call the class methods in other functions. Here is the code to demonstrate. Ajax call: kalimahJS(“.a”).click(function() { var data = { ‘action’: ‘list_items’ }; kalimahJS.ajax({ url: ajaxurl, type: “POST”, data: data, success: function(data, textStatus, jqXHR) { console.log(data); } […]

Plugin Development – Get Admin Url (Including cases where wp-admin is not used)

I’m currently writing a WordPress plugin, and am looking to retrieve the WordPress admin url. It sounds simple enough – and it is – assuming every WordPress install is using the default wp-admin slug; I could simply call get_admin_url(), which is a wrapper for get_site_url(), with wp-admin hard-coded (see here: However, I don’t want […]

How to translate wordpress backend to another language

Is there any way to translate wordpress entire backend to another language that is not supported yet. ? I mean, my language is Sinhala (Sri Lanka) and sinhala is not yet included by default on WordPress. But I’m looking for creating a plugin or something to translate backend to Sinhala. So, could anybody please tell […]