bp_core_exclude_pages_from_nav_menu_admin

Prevent specific pages (eg 'Activate') from showing in the Pages meta box of the Menu Administration screen.

Description

(object|null) bp_core_exclude_pages_from_nav_menu_admin( (null) $object = null ); 

Returns (object|null)

The $object, with a query argument to remove register and activate pages id.

Parameters (1)

0. $object — Optional. (null) => null
The post type object used in the meta box.

Usage

  1. if ( !function_exists( 'bp_core_exclude_pages_from_nav_menu_admin' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-filters.php'; 
  3.  
  4. // The post type object used in the meta box. 
  5. $object = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_exclude_pages_from_nav_menu_admin($object); 
  9.  

Defined (1)

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

/bp-core/bp-core-filters.php  
  1. function bp_core_exclude_pages_from_nav_menu_admin( $object = null ) { 
  2.  
  3. // Bail if not the root blog. 
  4. if ( ! bp_is_root_blog() ) { 
  5. return $object; 
  6.  
  7. if ( 'page' != $object->name ) { 
  8. return $object; 
  9.  
  10. $bp =buddypress); 
  11. $pages = array(); 
  12.  
  13. if ( ! empty( $bp->pages->activate ) ) { 
  14. $pages[] = $bp->pages->activate->id; 
  15.  
  16. if ( ! empty( $bp->pages->register ) ) { 
  17. $pages[] = $bp->pages->register->id; 
  18.  
  19. if ( ! empty( $pages ) ) { 
  20. $object->_default_query['post__not_in'] = $pages; 
  21.  
  22. return $object;