Do I require the use of nonce?

I think required would mean that “it doesn’t work without it”. It will work, but the question is of security and best practices. Even if it doesn’t seem necessary, it’s better to play in the safe side and do it always. You have to enqueue your JavaScript like bellow, passing PHP values (like the admin … Read more

How do I print a notice only on certain admin pages?

There is a global variable called $pagenow for the use within WP Admin: global $pagenow; if ( $pagenow == ‘upload.php’ ) : function custom_admin_notice() { echo ‘<div class=”updated”><p>Updated!</p></div>’; } add_action( ‘admin_notices’, ‘custom_admin_notice’ ); endif; UPDATE: Simply include the snippet in your themes or plugins functions.php

How to add a new plugin page under desired Options page?

Use add_submenu_page instead. <?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function ); ?> $parent_slug should be one of the following For Dashboard: add_submenu_page( ‘index.php’, … ); Also see add_dashboard_page() For Posts: add_submenu_page( ‘edit.php’, … ); Also see Also see add_posts_page() For Media: add_submenu_page( ‘upload.php’, … ); Also see add_media_page() For Links: add_submenu_page( ‘link-manager.php’, … ); … Read more

Notice: _usort_terms_by_ID is deprecated since version 4.7.0! Use wp_list_sort instead

The function wp_list_sort() has been introduced in WordPress 4.7. It wasn’t available before. That’s probably why your plugin isn’t using it. The function _usort_terms_by_ID() is still working, and it is actually much faster than wp_list_sort(). Which makes it hard to understand why it has been deprecated. But in your own code keep in mind that … Read more

Enqueue script only when shortcode is used, with WP Plugin Boilerplate

Why it’s not working: You need to use the wp_enqueue_scripts action hook. You’ve used wp_register_script as an action hook, however, there is no action hook named wp_register_script in WordPress core. If this was just a silly mistake, then you already have the answer. Read on if you need more information regarding the topic: Attaching a … Read more

How Does WordPress Uninclude/Deactivate A Plugin?

The active plugins are stored in the ‘active_plugins’ option, like this: array( ‘akismet/akismet.php’, ‘hello-dolly.php’, ); On each page load, WP just loops through that array and includes those files. It’s up to each plugin to include any additional files that it may have. When a plugin is deactivated, it’s just removed from that array. On … Read more