bp_core_clear_directory_pages_cache_page_edit( int $post_id )

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

Description

Parameters

$post_id

(int) (Required) ID of the page that was saved.

Source

File: bp-core/bp-core-cache.php

function bp_core_clear_directory_pages_cache_page_edit( $post_id = 0 ) {

	// Bail if BP is not defined here.
	if ( ! buddypress() ) {
		return;
	}

	// Bail if not on the root blog
	if ( ! bp_is_root_blog() ) {
		return;
	}

	$page_ids = bp_core_get_directory_page_ids( 'all' );

	// Bail if post ID is not a directory page
	if ( ! in_array( $post_id, $page_ids ) ) {
		return;
	}

	wp_cache_delete( 'directory_pages', 'bp_pages' );
}

Changelog

Changelog
Version Description
BuddyPress 2.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.