wafflecloud (@wafflecloud)

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • In reply to: Admin Bar Menu Editing

    wafflecloud
    Participant

    @wafflecloud

    That worked beautifully! You totally and completely rock….HARD!
    A huge thank you! I wish there was a button I could click to thank you with or something but all I can think to do is share my code so it can help others / hopefully prevent you from having to answer the same question again.

    Here is what I put to make it work:

    <?php
    function annointed_admin_bar_remove() {
            global $wp_admin_bar, $current_user;
            get_currentuserinfo();
    $myadmins = array(1, 3); // Add all IDs of the admins in this array
    if ( !in_array($current_user->ID, $myadmins) ) {
            $wp_admin_bar->remove_menu('wp-logo');          // Remove the WP Logo Menu
            $wp_admin_bar->remove_menu('site-name');        // Remove the site name menu
            $wp_admin_bar->remove_menu('view-site');        // Remove the view site link
    }
    }
    
    add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove');
    In reply to: Admin Bar Menu Editing

    wafflecloud
    Participant

    @wafflecloud

    Foremost I thank you for your assistance , you totally rock because it actually works now!

    Now my follow up question is a bit dumb but how would I include multiple admin user IDs?

    In reply to: Notifications Widget

    wafflecloud
    Participant

    @wafflecloud

    Sorry for double posting but I figured the following would be beneficial for anyone who might view this as well.

    I decided to go the latter route and used this code:

    
    function annointed_admin_bar_remove() {
            global $wp_admin_bar,        
            $wp_admin_bar->remove_menu('wp-logo');          // Remove the WP Logo Menu
            $wp_admin_bar->remove_menu('site-name');        // Remove the site name menu
            $wp_admin_bar->remove_menu('view-site');        // Remove the view site link
    
    }
    
    add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove');
    
Viewing 3 replies - 1 through 3 (of 3 total)