clean_post_cache
Action HookDescription
Fires immediately after the given post's cache is cleaned.Hook Information
File Location |
wp-includes/post.php
View on GitHub
|
Hook Type | Action |
Line Number | 7660 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$post_id
|
Post ID. |
WP_Post
|
$post
|
Post object. |
Usage Examples
Basic Usage
<?php
// Hook into clean_post_cache
add_action('clean_post_cache', 'my_custom_function', 10, 2);
function my_custom_function($post_id, $post) {
// Your custom code here
}
Source Code Context
wp-includes/post.php:7660
- How this hook is used in WordPress core
<?php
7655 * @since 2.5.0
7656 *
7657 * @param int $post_id Post ID.
7658 * @param WP_Post $post Post object.
7659 */
7660 do_action( 'clean_post_cache', $post->ID, $post );
7661
7662 if ( 'page' === $post->post_type ) {
7663 wp_cache_delete( 'all_page_ids', 'posts' );
7664
7665 /**
PHP Documentation
<?php
/**
* Fires immediately after the given post's cache is cleaned.
*
* @since 2.5.0
*
* @param int $post_id Post ID.
* @param WP_Post $post Post object.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.