Using WP_PLUGIN_DIR for include file

It doesn’t make a lot of sense, to me, to say “these should not be used directly by plugins”. I tend to think you should use an available function over the constant – if an available function exists – which, in your case, does not. I would go ahead and use the WP_PLUGIN_DIR constant.

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

How can I rename roles in a WordPress multisite installation?

I have made minor changes which can help you in achieving your desired results. We need to use network_admin_menu hook instead of init and also updated the condition of checking if the roles exist. <?php function wpmudev_custom_change_role_names_multisite() { // Here we are getting the roles of the network. $wp_roles = get_site_option(‘wp_user_roles’); // Here we are … 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