How to remove admin bar in WordPress

0 862

Visitor retention is one of the important aspects to improve website visibility. To achieve it some website allows their visitors to register. In WordPress also, visitors can register themselves with the visiting site if the registrations are open.

After registering, WordPress, by default, shows an admin bar for each of it’s registered visitors with the different options available. Although it is not always useful to each visitor and sometimes the owner doesn’t want to show the admin bar to its visitor to improve the user experience.

It can be achieved by adding the following piece of code in the file ‘functions.php’ of the active theme:

/**
 * Remove Admin Bar for registered visitors
 */
if ( ! current_user_can('manage_options') ) {
    add_filter( 'show_admin_bar', '__return_false' );
}

After adding the above code, the admin bar will not be visible to the visitors who will not have the management roles. It will not have any effect on the flow of the website and everything will go smooth.

If a registered visitor wants to check out its dashboard then it can be easily accessed using the following link:

http://www.example.com/wp-admin

Note: replace example.com with your website domain.

Some plugins are also available where you can provide a better user experience for registered visitors with a custom membership page.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More