Esempio n. 1
0
/**
 * Clear the VIP Go edge cache at the URLs associated with a term
 *
 * This includes:
 * * The term archive URL, paged back five pages as default
 * * The term feed
 *
 * You can filter how many of the pages of the archives are cleared
 * using the `wpcom_vip_cache_purge_urls_max_pages` filter.
 *
 * @param object|int $term Either the WP Term object, or the term_id
 *
 * @return bool True on success
 */
function wpcom_vip_purge_edge_cache_for_term($term)
{
    return WPCOM_VIP_Cache_Manager::instance()->queue_term_purge($term);
}
        }
        $this->purge_urls[] = $url;
        return true;
    }
    /**
     * Schedule purge of old permalink in case it was changed during post update
     * and only if the post's status was publish before the update
     *
     * @param int $post_ID The post ID of update post
     * @param WP_Post $post_after The post object as it looks after the update
     * @param WP_Post $post_before The post object as it looked before the update
     *
     * @return void
     */
    public function queue_old_permalink_purge($post_ID, $post_after, $post_before)
    {
        if (get_permalink($post_before) !== get_permalink($post_after) && 'publish' === $post_before->post_status) {
            $this->queue_purge_url(get_permalink($post_before));
        }
    }
    private function can_purge_cache()
    {
        if (!function_exists('is_proxied_automattician')) {
            // Local environment; no purging necessary here
            return false;
        }
        return is_proxied_automattician();
    }
}
WPCOM_VIP_Cache_Manager::instance();