bp_core_reset_subnav_items( string $parent_slug, string $component = 'members' )
Clear all subnav items from a specific nav item.
Description
Parameters
- $parent_slug
-
(Required) The slug of the parent navigation item.
- $component
-
(Optional) The component the navigation is attached to. Defaults to 'members'.
Default value: 'members'
Source
File: bp-core/bp-core-buddybar.php
function bp_core_reset_subnav_items( $parent_slug, $component = 'members' ) { $bp = buddypress(); if ( ! isset( $bp->{$component}->nav ) ) { return; } $subnav_items = $bp->{$component}->nav->get_secondary( array( 'parent_slug' => $parent_slug ), false ); if ( ! $subnav_items ) { return; } foreach( $subnav_items as $subnav_item ) { $bp->{$component}->nav->delete_nav( $subnav_item->slug, $parent_slug ); } }
Changelog
Version | Description |
---|---|
BuddyPress 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.