wp火箭不具备缓存功能

问题描述 投票:1回答:1

我在我的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缓存时,不计算发布视图。所以这是一个问题:如何禁用特定功能的缓存?

谢谢

wordpress caching
1个回答
0
投票

WP火箭没有从缓存中排除函数的选项,您要做的是排除正在调用此函数的页面。

check this link

© www.soinside.com 2019 - 2024. All rights reserved.