Valid characters for actions, hooks and filters

When you “hook”/add_action/*_filter(‘whatever’); a callback function to do_action(‘whatever’);, then you basically add the function (or object-method) name to the global $wp_filters-array. Doing so, you add the function/method name to an array that is built like the following $wp_filter[ $tag ][ $priority ][ $idx ] // $tag = action/filter name // $priority = 3rd argument / … Read more

remove_action in a theme

Your remove_action has to have a priority matching the priority used in add_action. Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure. http://codex.wordpress.org/Function_Reference/remove_action In you case, it looks like remove_action(‘wp_head’, ‘theme_metas’); should … Read more

wp_list_tables bulk actions

If you add a bulk-action, then you have to react on this action. Simply adding a function doesn’t do anything, you have to call it: class WPSE_List_Table extends WP_List_Table { public function __construct() { parent::__construct( array( ‘singular’ => ‘singular_form’, ‘plural’ => ‘plural_form’, ‘ajax’ => false ) ); } public function prepare_items() { $columns = $this->get_columns(); … Read more

When is admin_init Action ran?

From the Codex: admin_init is triggered before any other hook when a user access the admin area. This hook doesn’t provide any parameters, so it can only be used to callback a specified function. So yes, it’s run on every admin page load.

Perform an action when post is updated/published

The save_post action fires When a post is updated and/or published — including when a new post is inserted. <?php add_action( ‘save_post’, ‘wpse41912_save_post’ ); function wpse41912_save_post() { // do stuff } If you want your functions to fire only when a post is being edited, you can hook into edit_post. If you want it to … Read more