bp_core_create_root_component_page

Create WordPress pages to be used as BP component directories.

Description

bp_core_create_root_component_page(); 

Usage

  1. if ( !function_exists( 'bp_core_create_root_component_page' ) ) { 
  2. require_once '/bp-core/bp-core-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_core_create_root_component_page(); 
  7.  

Defined (1)

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

/bp-core/bp-core-functions.php  
  1. function bp_core_create_root_component_page() { 
  2.  
  3. // Get BuddyPress. 
  4. $bp = buddypress(); 
  5.  
  6. $new_page_ids = array(); 
  7.  
  8. foreach ( (array) $bp->add_root as $slug ) { 
  9. $new_page_ids[ $slug ] = wp_insert_post( array( 
  10. 'comment_status' => 'closed',  
  11. 'ping_status' => 'closed',  
  12. 'post_title' => ucwords( $slug ),  
  13. 'post_status' => 'publish',  
  14. 'post_type' => 'page' 
  15. ) ); 
  16.  
  17. $page_ids = array_merge( (array) $new_page_ids, (array) bp_core_get_directory_page_ids( 'all' ) ); 
  18. bp_core_update_directory_page_ids( $page_ids );