bp_core_get_directory_page_id( string|null $component = null )

Get the page ID corresponding to a component directory.

Description

Parameters

$component

(Optional) The slug representing the component. Defaults to the current component.

Default value: null

Return

(int|false) The ID of the directory page associated with the component. False if none is found.

Source

File: bp-core/bp-core-functions.php

554
555
556
557
558
559
560
561
562
563
564
565
566
567
function bp_core_get_directory_page_id( $component = null ) {
    if ( ! $component ) {
        $component = bp_current_component();
    }
 
    $bp_pages = bp_core_get_directory_page_ids( 'all' );
 
    $page_id = false;
    if ( $component && isset( $bp_pages[ $component ] ) ) {
        $page_id = (int) $bp_pages[ $component ];
    }
 
    return $page_id;
}

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.