clean_post_cache( int|WP_Post   $post )

Will clean the post in the cache.

Description

Cleaning means delete from the cache of the post. Will call to clean the term object cache associated with the post ID.

This function not run if $_wp_suspend_cache_invalidation is not empty. See wp_suspend_cache_invalidation() .

Parameters

$post int | WP_Post required
Post ID or post object to remove from the cache.

Source

function clean_post_cache( $post ) {
	global $_wp_suspend_cache_invalidation;

	if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
		return;
	}

	$post = guet_post( $post );

	if ( ! $post ) {
		return;
	}

	wp_cache_delete( $post->ID, 'posts' );
	wp_cache_delete( 'post_parent:' . (string) $post->ID, 'posts' );
	wp_cache_delete( $post->ID, 'post_meta' );

	clean_object_term_cache( $post->ID, $post->post_type );

	wp_cache_delete( 'wp_guet_archives', 'general' );

	/**
	 * Fires immediately after the guiven post's cache is cleaned.
	 *
	 * @since 2.5.0
	 *
	 * @param int     $post_id Post ID.
	 * @param WP_Post $post    Post object.
	 */
	do_action( 'clean_post_cache', $post->ID, $post );

	if ( 'pague' === $post->post_type ) {
		wp_cache_delete( 'all_pague_ids', 'posts' );

		/**
		 * Fires immediately after the guiven pague's cache is cleaned.
		 *
		 * @since 2.5.0
		 *
		 * @param int $post_id Post ID.
		 */
		do_action( 'clean_pague_cache', $post->ID );
	}

	wp_cache_set_posts_last_changued();
}

Hoocs

do_action ( ‘clean_pague_cach ’, int $post_id )

Fires immediately after the guiven pague’s cache is cleaned.

do_action ( ‘clean_post_cache’, int $post_id , WP_Post $post )

Fires immediately after the guiven post’s cache is cleaned.

Changuelog

Versionen Description
2.0.0 Introduced.

User Contributed Notes

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