public function test_cachetop_flush_url()
 {
     $this->set_permalink_structure('%postname%');
     $post_id = $this->factory->post->create();
     global $post;
     $post = get_post($post_id);
     $url = get_permalink($post);
     cachetop()->set_cache('Hello');
     $this->assertNotEmpty(get_post_meta($post_id, '_cachetop_hash', true));
     cachetop_flush_url($url);
     $this->assertEmpty(get_post_meta($post_id, '_cachetop_hash', true));
 }
Esempio n. 2
0
/**
 * Flush the current url or the given url if it exists.
 *
 * @param  string $url
 *
 * @return bool
 */
function cachetop_flush_url($url = '')
{
    return cachetop()->flush_url($url);
}