bp_core_clear_directory_pages_cache_page_edit

Clear the directory_pages cache when one of the pages is updated.

Description

bp_core_clear_directory_pages_cache_page_edit( (int) $post_id ); 

Parameters (1)

0. $post_id (int)
ID of the page that was saved.

Usage

  1. if ( !function_exists( 'bp_core_clear_directory_pages_cache_page_edit' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-core/bp-core-cache.php'; 
  3.  
  4. // ID of the page that was saved. 
  5. $post_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_core_clear_directory_pages_cache_page_edit($post_id); 
  9.  

Defined (1)

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

/bp-core/bp-core-cache.php  
  1. function bp_core_clear_directory_pages_cache_page_edit( $post_id ) { 
  2. if ( ! bp_is_root_blog() ) { 
  3. return; 
  4.  
  5. // Bail if BP is not defined here. 
  6. if ( !buddypress) ) { 
  7. return; 
  8.  
  9. $page_ids = bp_core_get_directory_page_ids( 'all' ); 
  10.  
  11. if ( ! in_array( $post_id, (array) $page_ids ) ) { 
  12. return; 
  13.  
  14. wp_cache_delete( 'directory_pages', 'bp_pages' );