Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

[Resolved] modify buddpress adminbar only in admin pages (4 posts)

Started 1 year, 1 month ago by: piphut

  • I have modified the buddpress admin bar by creating the following plugin which adds a simple text link to the bar:

    function bp_adminbar_currentsite_menu() {
    
    global $bp;
    link stuff
    }
    // Call The Function Above
    add_action('bp_adminbar_menus', 'bp_adminbar_currentsite_menu', 999);
    

    However, I do NOT want the above link to be shown when logged into the wordpress admin backend (so for example when an admin is editing a post). I thought about just doing a php_self check to see if it contained “/wp-admin/” but figured that there has to be a more elegant wordpress/buddypress hook here.

    How can I get the above code to only show when you are viewing a normal blog page, NOT in the admin area?

    Thanks

  • Profile picture of @mercime @mercime said 1 year, 1 month ago:

    Use the conditional function is_admin() to detect whether the user is in the WordPress admin area

    http://codex.wordpress.org/Function_Reference/is_admin

  • Thanks, that is exactly what I’m looking for

  • Profile picture of @mercime @mercime said 1 year, 1 month ago:

    You’re welcome ;-)