BP_Core_Nav::get( string $key = '' )

Gets a specific nav item or array of nav items.

Description

Parameters

$key

(string) (Optional) The nav item slug to get. Optional.

Default value: ''

Return

(mixed) An array of nav item, a single nav item, or null if none found.

Source

File: bp-core/classes/class-bp-core-nav.php

	public function get( $key = '' ) {
		$return = null;

		// Return the requested nav item.
		if ( ! empty( $key ) ) {
			if ( ! isset( $this->nav[ $this->object_id ][ $key ] ) ) {
				$return = null;
			} else {
				$return = $this->nav[ $this->object_id ][ $key ];
			}

		// Return all nav item items.
		} else {
			$return = $this->nav[ $this->object_id ];
		}

		return $return;
	}

Changelog

Changelog
Version Description
BuddyPress 2.6.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.