Support » Plugin: BuddyPress Docs » Remove Subnav Items

  • Resolved micster

    (@micster)


    Is it possible to remove the sub-nav items “Started By Me” and “Edited By Me” from the menus?

    I have tried this code:

    add_action( 'bp_actions', function() { 
    	bp_core_remove_nav_item( 'docs' ); 
    } );

    But I am obviously missing some parameters.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author David Cavins

    (@dcavins)

    Hi @micster-

    The “Started by Me” tab is the default, so removing it would be, uh, awkward, since there’d be nothing to display.

    You can remove sub nav items using BuddyPress’s Nav API (https://codex.buddypress.org/developer/navigation-api/). This example removes the “Edited by My” item:

    function dc_remove_member_edited_docs_tab() {
        if ( ! bp_is_user() ) {
            return;
        }
    
        bp_core_remove_subnav_item( 'docs', 'edited', 'members' );
    }
    add_action( 'bp_actions', 'dc_remove_member_edited_docs_tab' );

    This code can be placed in a bp-custom.php file (https://codex.buddypress.org/themes/bp-custom-php/) or wherever you keep your extra filters and actions.

    Best,

    -David

    • This reply was modified 9 months, 1 week ago by David Cavins.
    Plugin Author David Cavins

    (@dcavins)

    By the way, your code was close. It will remove the whole “Docs” tab from the user profile, though.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Remove Subnav Items’ is closed to new replies.