How to Add / Remove Admin Bar Links in WordPress

Опубликовано: 31 Октябрь 2024
на канале: Tech support
167
3

This video show you that how you can remove the wordpress admin bar, admin bar menu links and how to remove the whole admin bar.

1. This is the first line of code which I am using.
add_filter('show_admin_bar', '__return_false');

2. Second part of the code which is removing the admin bar for all user other then the admin.
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}

3. At last code I am using is for removing link one by one is here.
function mytheme_admin_bar_render() {
global $wp_admin_bar;
// we can remove a menu item, like the Comments link, just by knowing the right $id
$wp_admin_bar-)remove_menu('comments');
// or we can remove a submenu, like New Link.
$wp_admin_bar-)remove_menu('new-link', 'new-content');
// we can add a submenu item too
$wp_admin_bar-)add_menu( array(
'parent' =) 'new-content',
'id' =) 'new_media',
'title' =) __('Media'),
'href' =) admin_url( 'media-new.php')
) );
}
// and we hook our function via
add_action(''wp_before_admin_bar_render', 'mytheme_admin_bar_render' );


Watch the video step by step and you can customize the full Wordpress Admin Bar.

You can Watch my Video of the Google Web Stories Plugin.    • Google Web Stories Plugin For More St...  

You can watch my video for the Wordpress Installation.    • How to Install Wordpress on Wamp  

You can Install ASTRA THEME Watch this Video.    • How To Setup Astra Theme Full Tutoria...  

You can Install the MyListing theme by watching this video.    • How to Install and Setup MyListing Theme  

How to download the images and Video file without using IDM watch this video:    • How To Download Images and Video From...  


For more Detailed Information You can Comment Us Below.

LIKE | SHARE | SUBSCRIBE

For More inquiries: [email protected]
OR
Comment us below.

Thanks