• Resolved Luke

    (@danceyrselfclean_admin)


    Hi I would like to remove or hide the sidebar debug top menu item that shows when viewing the site logged in on the front end.

    I want to hide it to simplify the site for my clients.

    Is there any code I can stick in the functions.php or a custom plugin to remove this?

Viewing 1 replies (of 1 total)
  • Hello @danceyrselfclean_admin

    You can surpass this by using the following snippet:

    function remove_admin_links( $wp_admin_bar ) {
    	if ( 1 !== get_current_user_id() ) {
    		// remove Sidebar Debug link (Custom Sidebars plugin)
    		$wp_admin_bar->remove_node( 'cs-explain' );
    	}
    }
    add_action( 'admin_bar_menu', 'remove_admin_links', 9999 );

    I also included a check for user ID=1 which is the initial WP admin user by default. Feel free to edit this with your own user ID, if different.

    Warm regards,
    Dimitris

Viewing 1 replies (of 1 total)

The topic ‘Remove sidebar debug’ is closed to new replies.