function batcache_post($post_id) { global $batcache; $post = get_post($post_id); if ($post->post_type == 'revision' || !in_array(get_post_status($post_id), array('publish', 'trash'))) { return; } batcache_clear_url(get_option('home')); batcache_clear_url(trailingslashit(get_option('home'))); batcache_clear_url(get_permalink($post_id)); }
function batcache_post($post_id) { global $batcache; $post = get_post($post_id); if (empty($post) || $post->post_type == 'revision' || get_post_status($post_id) != 'publish') { return; } batcache_clear_url(get_option('home')); batcache_clear_url(trailingslashit(get_option('home'))); batcache_clear_url(get_permalink($post_id)); }
function batcache_post($post_id, $post = null) { global $batcache; // Get the post for backwards compatibility with earlier versions of WordPress if (!$post) { $post = get_post($post_id); } if (!$post || $post->post_type == 'revision' || !in_array(get_post_status($post_id), array('publish', 'trash'))) { return; } $home = trailingslashit(get_option('home')); batcache_clear_url($home); batcache_clear_url($home . 'feed/'); batcache_clear_url(get_permalink($post_id)); }