_reset_privacy_policy_page_for_post()WP 7.1.0

Resets the Privacy Policy page ID option when the Privacy Policy page is permanently deleted, to prevent uncached database queries for a non-existent page.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Returns

null. Nothing (null).

Usage

_reset_privacy_policy_page_for_post( $post_id ): void;
$post_id(int) (required)
The ID of the post being deleted.

Changelog

Since 7.1.0 Introduced.

_reset_privacy_policy_page_for_post() code WP 7.1

function _reset_privacy_policy_page_for_post( int $post_id ): void {
	if ( 'page' === get_post_type( $post_id ) && ( (int) get_option( 'wp_page_for_privacy_policy' ) === $post_id ) ) {
		update_option( 'wp_page_for_privacy_policy', 0 );
	}
}