WordPress at Your Fingertips
function is not described

WP_Privacy_Policy_Content::_policy_page_updated() public WP 4.9.6

Update the cached policy info when the policy page is updated.

{} It's a method of the class: WP_Privacy_Policy_Content{}

No Hooks.

Return

null. Nothing.

Usage

$result = WP_Privacy_Policy_Content::_policy_page_updated( $post_id );
$post_id(int) (required)
The ID of the updated post.

Changelog

Since 4.9.6 Introduced.

Code of WP_Privacy_Policy_Content::_policy_page_updated() WP 5.8.2

public static function _policy_page_updated( $post_id ) {
	$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );

	if ( ! $policy_page_id || $policy_page_id !== (int) $post_id ) {
		return;
	}

	// Remove updated|removed status.
	$old          = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
	$done         = array();
	$update_cache = false;

	foreach ( $old as $old_key => $old_data ) {
		if ( ! empty( $old_data['removed'] ) ) {
			// Remove the old policy text.
			$update_cache = true;
			continue;
		}

		if ( ! empty( $old_data['updated'] ) ) {
			// 'updated' is now 'added'.
			$done[]       = array(
				'plugin_name' => $old_data['plugin_name'],
				'policy_text' => $old_data['policy_text'],
				'added'       => $old_data['updated'],
			);
			$update_cache = true;
		} else {
			$done[] = $old_data;
		}
	}

	if ( $update_cache ) {
		delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
		// Update the cache.
		foreach ( $done as $data ) {
			add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
		}
	}
}