WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add a new tab/page in the groups page.

This is the code I'm using:

Plugin Name: Groups Links
Description: Add links to the groups page.
Author: Thomas Clayson
function add_groups_links_page(){
    global $bp;

    $groups_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/';

    bp_core_new_subnav_item( array(
       'name' => 'Links',
       'slug' => 'group-links',
       'parent_url' => $groups_link,
       'parent_slug' => $bp->groups->slug,
       'screen_function' => 'group_links_function_to_show_screen',
       'position' => 40 ) );
add_action( 'wp', 'add_groups_links_page');

function group_links_function_to_show_screen() {

    add_action( 'bp_template_title', 'group_links_function_to_show_screen_title' );
    add_action( 'bp_template_content', 'group_links_function_to_show_screen_content' );

    $templates = array('groups/single/plugins.php','plugin-template.php');
    if( strstr( locate_template($templates), 'groups/single/plugins.php' ) ) {
        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) );
    } else {
        bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) );

function group_links_function_to_show_screen_title() {
    echo 'Links';

function group_links_function_to_show_screen_content() { 
    echo "Rawr";


Yet when I click on "Links" on the groups page it just takes me back to the homepage! :( I have no idea why this isn't working. Here is a screenshot of the page:

enter image description here

In the picture I've mouse-over'd the link and you can see that it points to the right place... wordpressdomain/groups/test-group/group-links/ however clicking it takes me to the homepage! :(

Any ideas?

Thank you.

share|improve this question

closed as off-topic by birgire, ialocin, toscho Aug 6 '14 at 18:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

Let me know if you find an answer to this. This has been driving me nuts all day! – Brian Fegter Apr 20 '11 at 15:30
nothing yet... :( – Thomas Clayson Apr 21 '11 at 15:09

instead of this:

'slug' => 'group-links',
'parent_url' => $groups_link,

Use this:

'parent_slug' => $bp->groups->current_group->slug, 
'parent_url' => bp_get_group_permalink( $bp->groups->current_group ), 
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.