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

Gets a specific nav item or array of nav items.

Description

Parameters

$key

(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

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
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.