modify BuddyPress adminbar only in admin pages

Question!

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

function bp_adminbar_currentsite_menu() {

global $bp;
?>
<li>
<!-- Insert your link url or relative url, and your link text below -->
<a href="http://EXAMPLE.COM">EXAMPLE LINK TEXT</a>
</li>
<?php
}
// 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



Answers

using is_admin() is the answer. It is a wordpress function that checks to see if you are looking at admin pages or not.



This video can help you solving your question :)
By: admin