I'd like to alter admin url only inside "My Sites" admin bar menu..

enter image description here

I tried this filter:

add_filter( 'admin_url', function( $url, $path, $blog_id ){ return $url . "str" });

but when I do that it messes up every post edit post link?

Is there a way I can edit admin url only to that scoped section?

Thanks for any insights!

  • Instead of using the admin_url filter, have you tried using the admin_bar_menu action hook? It allows you to modify to rewrite the items inside the admin toolbar: wordpress.stackexchange.com/questions/96869/…
    – John Doe
    Oct 29, 2019 at 8:11
  • thanks for helo @terresquall but I can't hook into $wp_admin_bar->get_node('my-sites') instance there ... to be able to manipulate items? Oct 29, 2019 at 10:59


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.