Add some clean cache hooks
git-svn-id: http://svn.automattic.com/wordpress/trunk@6248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bd5d107814
commit
363eae9d76
|
@ -514,6 +514,8 @@ function wp_delete_post($postid = 0) {
|
|||
if ( 'page' == $post->post_type ) {
|
||||
clean_page_cache($postid);
|
||||
$wp_rewrite->flush_rules();
|
||||
} else {
|
||||
clean_post_cache($postid);
|
||||
}
|
||||
|
||||
do_action('deleted_post', $postid);
|
||||
|
@ -1358,6 +1360,8 @@ function wp_delete_attachment($postid) {
|
|||
if ( ! empty($file) )
|
||||
@ unlink($file);
|
||||
|
||||
clean_post_cache($postid);
|
||||
|
||||
do_action('delete_attachment', $postid);
|
||||
|
||||
return $post;
|
||||
|
@ -1627,6 +1631,8 @@ function clean_post_cache($id) {
|
|||
wp_cache_delete($id, 'post_meta');
|
||||
|
||||
clean_object_term_cache($id, 'post');
|
||||
|
||||
do_action('clean_post_cache', $id);
|
||||
}
|
||||
|
||||
function update_page_cache(&$pages) {
|
||||
|
@ -1638,6 +1644,8 @@ function clean_page_cache($id) {
|
|||
|
||||
wp_cache_delete( 'all_page_ids', 'pages' );
|
||||
wp_cache_delete( 'get_pages', 'page' );
|
||||
|
||||
do_action('clean_page_cache', $id);
|
||||
}
|
||||
|
||||
function update_post_caches(&$posts) {
|
||||
|
|
|
@ -832,6 +832,7 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
|
|||
|
||||
clean_term_cache($term, $taxonomy);
|
||||
|
||||
do_action('delete_term', $term, $tt_id, $taxonomy);
|
||||
do_action("delete_$taxonomy", $term, $tt_id);
|
||||
|
||||
return true;
|
||||
|
@ -1176,6 +1177,8 @@ function clean_object_term_cache($object_ids, $object_type) {
|
|||
|
||||
foreach ( $object_ids as $id )
|
||||
wp_cache_delete($id, 'object_terms');
|
||||
|
||||
do_action('clean_object_term_cache', $object_ids, $object_type);
|
||||
}
|
||||
|
||||
function clean_term_cache($ids, $taxonomy = '') {
|
||||
|
@ -1208,6 +1211,8 @@ function clean_term_cache($ids, $taxonomy = '') {
|
|||
}
|
||||
|
||||
wp_cache_delete('get_terms', 'terms');
|
||||
|
||||
do_action('clean_term_cache', $ids, $taxonomy);
|
||||
}
|
||||
|
||||
function &get_object_term_cache($id, $taxonomy) {
|
||||
|
|
Loading…
Reference in New Issue