/** * Clear the cache for this entry and for all posts which are "related" to it. * @since 3.2 This is called when a post is deleted. */ functiondelete_post($post_ID) { // Clear the cache for this post. $this->clear((int) $post_ID);
// Find all "peers" which list this post as a related post and clear their caches if ($peers = $this->related(null, (int) $post_ID)) $this->clear($peers); }
/** * @since 3.4 Don't compute on revisions * @since 3.5 Compute on the parent instead */ if ($the_post = wp_is_post_revision($post_ID)) $post_ID = $the_post;
// Un-publish if ($old_status === 'publish' && $new_status !== 'publish') { // Find all "peers" which list this post as a related post and clear their caches if ($peers = $this->related(null, (int) $post_ID)) $this->clear($peers); }
// Publish if ($old_status !== 'publish' && $new_status === 'publish') { /* * Find everything which is related to this post, and clear them, * so that this post might show up as related to them. */ if ($related = $this->related($post_ID, null)) $this->clear($related); }
/** * @since 3.4 Simply clear the cache on save; don't recompute. */ $this->clear((int) $post_ID);
/** * Clear the cache for this entry and for all posts which are "related" to it. * @since 3.2 This is called when a post is deleted. */ functiondelete_post($post_ID) { // Clear the cache for this post. $this->clear((int) $post_ID);
$this->clearall();
// Find all "peers" which list this post as a related post and clear their caches if ($peers = $this->related(null, (int) $post_ID)) $this->clear($peers); } /** * @since 3.2.1 Handle various post_status transitions */ functiontransition_post_status($new_status, $old_status, $post) { $post_ID = $post->ID;
/** * @since 3.4 Don't compute on revisions * @since 3.5 Compute on the parent instead */ if ($the_post = wp_is_post_revision($post_ID)) $post_ID = $the_post;
// Un-publish if ($old_status === 'publish' && $new_status !== 'publish') { // Find all "peers" which list this post as a related post and clear their caches if ($peers = $this->related(null, (int) $post_ID)) $this->clear($peers); }
// Publish if ($old_status !== 'publish' && $new_status === 'publish') { /* * Find everything which is related to this post, and clear them, * so that this post might show up as related to them. */ if ($related = $this->related($post_ID, null)) $this->clear($related); }
/** * @since 3.4 Simply clear the cache on save; don't recompute. */ $this->clear((int) $post_ID);