[wp-trac] [WordPress Trac] #31586: Admin Bar: site-name link for is_admin() in admin-bar.php
WordPress Trac
noreply at wordpress.org
Tue Mar 10 21:30:50 UTC 2015
#31586: Admin Bar: site-name link for is_admin() in admin-bar.php
-------------------------+-------------------------
Reporter: landwire | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Toolbar | Version: 4.1.1
Severity: normal | Resolution: worksforme
Keywords: | Focuses: ui
-------------------------+-------------------------
Changes (by ocean90):
* status: new => closed
* resolution: => worksforme
* milestone: Awaiting Review =>
Comment:
Hello Sascha,
you can do this already with the following code:
{{{
function trac_replace_site_name_link_in_toolbar( $wp_admin_bar ) {
if ( ! $wp_admin_bar->get_node( 'site-name' ) ) {
return;
}
$menu = array( 'id' => 'site-name', 'href' => home_url( '/' ) );
$wp_admin_bar->add_menu( $menu );
}
add_action( 'admin_bar_menu', 'trac_replace_site_name_link_in_toolbar', 35
);
}}}
There is no need for a new filter here.
> I am quite happy to link to the home_url for all users, also admins.
Hint: [https://developer.wordpress.org/reference/functions/is_admin/
is_admin()] exists to check whether the current request is for an
administrative interface page, and not if the user is an administrator.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31586#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list