bp_core_get_directory_page_id

Get the page ID corresponding to a component directory.

Description

(int|bool) bp_core_get_directory_page_id( (null) $component = null ); 

Returns (int|bool)

The ID of the directory page associated with the component. False if none is found.

Parameters (1)

0. $component — Optional. (null) => null
The slug representing the component. Defaults to the current component.

Usage

  1. if ( !function_exists( 'bp_core_get_directory_page_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; 
  3.  
  4. // The slug representing the component. Defaults to the current component. 
  5. $component = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_get_directory_page_id($component); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-core/bp-core-functions.php  
  1. function bp_core_get_directory_page_id( $component = null ) { 
  2. if ( ! $component ) { 
  3. $component = bp_current_component(); 
  4.  
  5. $bp_pages = bp_core_get_directory_page_ids( 'all' ); 
  6.  
  7. $page_id = false; 
  8. if ( $component && isset( $bp_pages[ $component ] ) ) { 
  9. $page_id = (int) $bp_pages[ $component ]; 
  10.  
  11. return $page_id;