bp_core_reset_subnav_items( string $parent_slug, string $component = 'members' )

Clear all subnav items from a specific nav item.


Parameters Parameters

$parent_slug

(string) (Required) The slug of the parent navigation item.

$component

(string) (Optional) The component the navigation is attached to. Defaults to 'members'.

Default value: 'members'


Source 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 );
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.6.0 Introduced the $component parameter.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.