[wp-hackers] Disable specific filters only for admin bar

Tom Barrett tcbarrett at gmail.com
Wed Aug 28 15:05:22 UTC 2013


I couldn't find unique start and end hooks, just a series of admin_bar_menu
actions with increasing priority args (wp-includes/class-wp-admin-bar.php).

So I went for this:

/**
 * Remove Domain Mapping filters from admin bar
 * NB: The 'My Account' item (edit profile, login/out is also piority 0, so
it might not work)
 */
add_action( 'admin_bar_menu', 'cwn_wp_before_admin_bar_render', 0 );
function cwn_wp_before_admin_bar_render(){
        remove_filter( 'pre_option_siteurl', 'domain_mapping_siteurl' );
}
add_action( 'admin_bar_menu', 'cwn_wp_after_admin_bar_render', 999 );
function cwn_wp_after_admin_bar_render(){
        add_filter( 'pre_option_siteurl', 'domain_mapping_siteurl' );
}

HTH


On 28 August 2013 10:32, Tom Barrett <tcbarrett at gmail.com> wrote:

> Hello
>
> Is it possible to remove (and then re-add) filters just for the admin bar
> (on a network enabled installation)?
>
> There is the long way of re-building the whole thing, but I wondered if
> there was a tidier way.
>
> Thanks.
>
> --
> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> http://twitter.com/tcbarrett
>



-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list