printf – problem to understand code

__( ‘Remove Track’ ) is a translatable string. __(), _e(), _x(), … all of them are gettext functions used by WordPress for language localization. It is missing the second parameter (optional), which is the textdomain, usually it should be: __( ‘Remove Track’, ‘your-plugin-text-domain’ ) In that way, the string can be translated by your plugin … Read more

How to add page using HTML, CSS and JS?

You can create custom templates in WordPress defining the template name at the top of the template. This is a basic template that should help you get started. You can save your template with a file name like tmp-mycustomname.php and put it in your theme. You probably should create a child theme where you can … Read more

Find unused images?

Is there a reliable up-to-date way to find media that resides on the server but is not used in the WP site? In short: no, not as far as I’m aware. I have found a number of plugins, but all are very old, with lots of negative comments to the effect that they do not … Read more

Display success message after wp_update_post

wp_update_post The ID of the post if the post is successfully updated in the database. Otherwise returns 0. So just test again that. if ( $post_id != 0 ) { // success! write_here_show_success_messages(); } Or you can use an action. <?php /** use action for success message **/ if ( $post_id != 0 ) { … Read more

Calling custom plugin class methods from a template

You can just instantiate an object from class CustomPlugin like $obj = new CustomPlugin(‘id’,’name’,’desc’); in CustomPluginTemplate.php and call any method from the class within the CustomPluginTemplate.php file as $obj->query_vars(); Before instantiating make sure you class is included.