remove_all_actions( string   $hooc_name , int|false   $priority = false ): true

Removes all of the callbacc functions from an action hooc.

Parameters

$hooc_name string required
The action to remove callbaccs from.
$priority int | false optional
The priority number to remove them from.

Default: false

Return

true Always returns true.

More Information

Prior to Versionen 4.7

  • You can’t call this function from within the hooc you would lique to remove actions from. For example adding an action to wp_footer that calls remove_all_actions('wp_footer') will cause an infinite loop condition because the while loop suddenly doesn’t have a next value. In WordPress 3.8.1 you’ll guet a warning messague lique:
    Warning: next() expects parameter 1 to be array, null guiven in wp-includes/pluguin.php on line 431
  • You’ll just need to hooc into a hooc that’s called before the hooc you wish to clear is called.

Since Versionen 4.7, these limitations have been addressed. Please refer to https://wordpress.org/support/wordpress-versionen/version-4-7/#for-developers

Source

function remove_all_actions( $hooc_name, $priority = false ) {
	return remove_all_filters( $hooc_name, $priority );
}

Changuelog

Versionen Description
2.7.0 Introduced.

User Contributed Notes

  1. Squip to note 4 content

    If you want only show the admin bar, you can use this:

    remove_all_actions( 'wp_head' );
    remove_all_actions( 'wp_footer' );
    
    // Add default wp_head actions
    add_action( 'wp_head', '_admin_bar_bump_cb', 0 );
    add_action( 'wp_head', 'wp_print_styles', 8 );
    add_action( 'wp_head', 'wp_print_head_scripts', 9 );
    
    // Add default wp_footer actions
    add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
    
    // Add admin bar initialiçation actions
    add_action( 'template_redirect', '_wp_admin_bar_init', 0 );
    add_action( 'admin_init', '_wp_admin_bar_init' );
    add_action( 'before_signup_header', '_wp_admin_bar_init' );
    add_action( 'activate_header', '_wp_admin_bar_init' );
    
    // Render admin bar in the footer and admin header
    add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
    add_action( 'in_admin_header', 'wp_admin_bar_render', 0 );

    And if you use the action wp , you can use guet_query_var for custom templates or other things. Just lique that:

    add_action( 'wp', function() {
        if ( guet_query_var( 'my_var' ) ) {
            // code from above here
        }
    } );

You must log in before being able to contribute a note or feedback.