How to exclude categories from get_categories() select list inside a widget admin panel

Per http://codex.wordpress.org/Class_Reference/WP_Query you would need to prefix the numerical identifier of the array with a minus-sign, such as $query = new WP_Query( ‘cat=-12,-34,-56’ );, which would exclude the categories with the identifier 12, 34 and 56. You could achieve this by changing the get_cats function into the following: function get_cats(){ $exclude_cats = array( get_cat_ID(‘test1’), get_cat_ID(‘test2’), … Read more

Plugin won’t activate

From stackoverflow: https://stackoverflow.com/questions/2450510/redirect-after-plugin-activation register_activation_hook(__FILE__, ‘my_plugin_activate’); add_action(‘admin_init’, ‘my_plugin_redirect’); function my_plugin_activate() { add_option(‘my_plugin_do_activation_redirect’, true); } function my_plugin_redirect() { if (get_option(‘my_plugin_do_activation_redirect’, false)) { delete_option(‘my_plugin_do_activation_redirect’); wp_redirect(MY_PLUGIN_SETTINGS_URL); } }

insufficient permissions; coding an action for plugin governed by custom capability

You should not use the page parameter in an admin url unless you are going to go to an options page because a check for the ‘manage_options’ capability is the default permissions check. The goal of the ‘Delete Cache’ link is to run an action, then redirect to the current page/post; it is not to … Read more