WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to remove link to about.php wordpress under admin bar logo (4 posts)

  1. mienque
    Member
    Posted 1 year ago #

    I use this code to create a simple plugin to remove some default menus links and replace wp admin bar logo by my own logo on admin bar

    /* Removes parts of the admin bar */
    
    function wpzoom_admin_bar_remove() {
    	global $wp_admin_bar;
    	/* Remove their stuff */
    	$wp_admin_bar->remove_menu('about');
    	$wp_admin_bar->remove_menu('wporg');
    	$wp_admin_bar->remove_menu('documentation');
    	$wp_admin_bar->remove_menu('support-forums');
    	$wp_admin_bar->remove_menu('feedback');
    	$wp_admin_bar->remove_menu('my-sites');
    	$wp_admin_bar->remove_node('search');
    	$wp_admin_bar->remove_menu('wpseo-menu');
    
    }
    
    add_action('wp_before_admin_bar_render', 'wpzoom_admin_bar_remove', 0);
    /*
     * Replace default wp logo by cyberim logo
     */
    function cyberim_custom_logo() {
    echo '
    <style type="text/css">
    #wp-admin-bar-wp-logo > .ab-item .ab-icon {
    	background-image: url(' . get_bloginfo('stylesheet_directory') . '/images/cyberim_bar_logo.png) !important;
    	width: 60px;
    	background-position: 0 0;
    	}
    #wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
    	background-position: 0 0;
    	}
    </style>
    ';
    }
    add_action('wp_before_admin_bar_render', 'cyberim_custom_logo', 0);

    I have successfully remove almost links and wp logo. But when I click on admin bar logo it still redirect to wwww.cyberim.com/about.php.
    I want to remove the above link also but had added $wp_admin_bar->remove_menu('about'); still not work.
    Is there any way to remove it please

  2. bcworkz
    Member
    Posted 1 year ago #

    You've altered the wp logo graphic, but the underlying 'wp-logo' menu item still exists, with its link to about.php. You'll either need to remove it and add a new menu element with your logo back in, or I believe you can simply overwrite the 'href' value of 'wp-logo' with the add_node() method.

  3. mienque
    Member
    Posted 1 year ago #

    Could you please instruct me a bit more. I am a newbie, the above plugin I combine some pieces of code from some tips. I did not write it myself.
    Thanks,

  4. mienque
    Member
    Posted 1 year ago #

    Solved it now, thank you for your clue

Topic Closed

This topic has been closed to new replies.

About this Topic