Plugin’s “Update Now” not working – Installed in folder with random suffix

I tried the hook update_plugins_{$hostname} following the fresher informations I found in the link quoted by Tom J Nowell : https://make.wordpress.org/core/2021/06/29/introducing-update-uri-plugin-header-in-wordpress-5-8/ here is a example of plugin with self managed update. it’s a base for update by the Updates page and the Plugins page and this example can be complete to manage more details, e.g. … Read more

Create a zip code form

WordPress (or any other CMS) doesn’t have this feature by default. You need to find a plugin (I doubt if the exact plugin like this exist), or build your own code. I suppose your code should have a form for user to enter their post code. Based on the post code value, you can determine … Read more

adding an options menu that allows saving multiple sets of said options

here an example of how to manage multiple set of options. it needs to be completed by a nonce to avoid CSRF attack and it needs also a little bit of layout. add_action(“admin_menu”, function () { add_menu_page( “Multioptions” , “Multioptions” , “manage_options” // capability to be allowed to edit options , “MY_PLUGIN__multioptions” , function () … Read more

`post_updated_messages` filter

The function you attach as a filter needs to take in a variable as an argument and return that variable once it’s done processing whatever it is you need it to do. For example: function wpse426272_messages( $messages ) { $messages[‘game’] = array( ‘Game updated’, ‘Game published’, ‘etc’ ); return $messages; } add_filter( ‘post_updated_messages’, ‘wpse426272_messages’ );

How to use native wordpress translation domain inside a custom plugin?

How to use native wordpress translation domain inside a custom plugin? You would use __() without a textdomain, but this won’t work for you because that’s not how post status labels work. get_post_status doesn’t return the name of the post status, it returns a slug, e.g. pending not Pending. The solution is in the user … Read more

Fetch portion of Admin URL

Detecting WordPress admin screens using URL parameters can be a pain in the butt and also raise security issues. However, there’s a whole set of built in functions ready to help… but first off, why are you trying to detect an admin page using a funky string like admin.php?page=my-custom-page is this an admin page? an … Read more

$_GET[”] variable with nonce verification

There are two ways of creating nonce verification for $_GET parameters: If you are coming from a form, you can use the wp_nonce_field function to create your own field. For example: <form action=”edit.php” method=”get”> <input type=”text” name=”example”> ….. <?php wp_nonce_field(‘my_custom_action’, ‘my_custom_name’); ?> <input type=”submit” value=”Submit”> </form> If you are coming from a link you created, … Read more