bp_core_on_directory_page_delete( int $post_id )

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

Description

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

Parameters

$post_id

(int) (Required) Post ID.

Source

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

function bp_core_on_directory_page_delete( $post_id ) {

	// Stop if we are not on the main BP root blog.
	if ( ! bp_is_root_blog() ) {
		return;
	}

	$page_ids       = bp_core_get_directory_page_ids( 'all' );
	$component_name = array_search( $post_id, $page_ids );

	if ( ! empty( $component_name ) ) {
		unset( $page_ids[ $component_name ] );
	}

	bp_core_update_directory_page_ids( $page_ids );
}

Changelog

Changelog
Version Description
BuddyPress 2.2.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.