Quick Logout Link For WordPress
Hi,
Logging out from WordPress becomes very irritating and time consuming sometimes, as you have to hover over the ‘Howdy, admin’ link, then wait for the pop down, and then click on the log out link. Sometimes the pop down takes a longer time to show depending on your browser and sometimes you end up clicking the ‘Howdy, admin’ link thus causing a page refresh.
There might be times when every last second counts and this logout process turns out to be a liability. Hence I’ve written a small snippet to shorten this process to just one click. This code will add a ‘Log Out’ link to the left of the ‘Howdy, admin’ link, hence no need to hover and wait anymore!
—————————————————————————————————————————
add_action(‘admin_bar_menu’, ‘rtp_logout_url’);
function rtp_logout_url($admin_bar)
{
$args = array(
‘id’ => ‘rtp-logout’,
‘title’ => ‘Log Out’,
‘href’ => wp_logout_url(),
‘parent’ => ‘top-secondary’,
‘meta’ => array(
‘title’ => __(‘Log Out Now!’),
),
);
$admin_bar->add_menu( $args);
}
—————————————————————————————————————————–
Just paste this code to your theme’s functions.php file and you’re done!
Doesn’t look very essential as such, but saves a few seconds (and from frustration)!
Issued in public interest by,
Rutwick
Gagan 6:01 am on March 14, 2012 Permalink | Log in to Reply
But why do we need logout for?
Even if we need to test the site from different user or as a guest, we can always use the Incognito Window(in Chrome), Private Browsing (in Firefox) or InPrivate Browsing(in IE)
Rutwick 6:24 am on March 14, 2012 Permalink | Log in to Reply
This trick has got nothing to do with testing! Its just to improve user experience.