bp_core_clear_directory_pages_cache_page_edit( int $post_id )

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


Description Description


Parameters Parameters

$post_id

(Required) ID of the page that was saved.


Top ↑

Source 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' );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.