bp_core_on_directory_page_delete

Remove the entry from bp_pages when the corresponding WP page is deleted.

Description

bp_core_on_directory_page_delete( (int) $post_id ); 

Bails early on multisite installations when not viewing the root site.

Parameters (1)

0. $post_id (int)
The post id.

Usage

  1. if ( !function_exists( 'bp_core_on_directory_page_delete' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-functions.php'; 
  3.  
  4. // The post id. 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_on_directory_page_delete($post_id); 
  9.  

Defined (1)

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

/bp-core/bp-core-functions.php  
  1. function bp_core_on_directory_page_delete( $post_id ) { 
  2.  
  3. // Stop if we are not on the main BP root blog. 
  4. if ( ! bp_is_root_blog() ) { 
  5. return; 
  6.  
  7. $page_ids = bp_core_get_directory_page_ids( 'all' ); 
  8. $component_name = array_search( $post_id, $page_ids ); 
  9.  
  10. if ( ! empty( $component_name ) ) { 
  11. unset( $page_ids[ $component_name ] ); 
  12.