How to remove admin bar links in WordPress

Hi guys! In this tutorial I will explain how you can remove the links from admin bar in Wordpress. I will explain also how you can add new links in admin bar.

So, if you want to remove links from admin bar in Wordpress, you must create a new function in functions.php like this:

function remove_links() {
global $wp_admin_bar;
}
add_action('wp_before_admin_bar_render', 'remove__links');

Next, if you want to remove the Wordpress's logo, add this code:

$wp_admin_bar->remove_menu('wp-logo');

in your function.

If you want to remove the about WordPress link, add this code:

$wp_admin_bar->remove_menu('about');

If you want to remove the WordPress.org link, add this code:

$wp_admin_bar->remove_menu('wporg');

If you want to remove the WordPress documentation link, add this code:

$wp_admin_bar->remove_menu('documentation');

If you want to remove the support forums link, add this code:

$wp_admin_bar->remove_menu('documentation');

If you want to remove the support forums link, add this code:

$wp_admin_bar->remove_menu('support-forums');

If you want to remove the feedback link, add this code:

$wp_admin_bar->remove_menu('feedback');

If you want to remove the site name menu, add this code:

$wp_admin_bar->remove_menu('site-name');

If you want to remove the view site link, add this code:

$wp_admin_bar->remove_menu('view-site');

If you want to remove the updates link, add this code:

$wp_admin_bar->remove_menu('updates');

If you want to remove the comments link, add this code:

$wp_admin_bar->remove_menu('comments');

If you want to remove the content link, add this code:

$wp_admin_bar->remove_menu('new-content');

 

 

But if you want to add new links in admin bar, use this code:

add_action('admin_bar_menu', 'add_new_link', 100);
function add_new_link($admin_bar)
{
$args = array(
'id' => 'tutorials',
'title' => 'Scrisoft Tutorials',
'href' => 'http://tutorials.scrisoft.com/',
'meta' => array('title' => __('Scrisoft Tutorials'),
),
);
$admin_bar->add_menu( $args);
}









Leave a Comment