WP火箭不具备缓存功能

时间:2019-12-28 18:11:55

标签: wordpress caching

我在我的wordpress网站中使用wp-rocket缓存插件。 我具有以下功能来统计帖子浏览量:

function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
return "0 view";
}
return $count.' view';
}

function setPostViews($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
    $count = 0;
    delete_post_meta($postID, $count_key);
    add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);

但是当我启用wp-rocket缓存时,不计算发布视图。所以这是一个问题:如何禁用特定功能的缓存?

谢谢

0 个答案:

没有答案