1、删除某一个页面的缓存:发表评论、按下F5刷新、在URL后面加上?r=y回车。
2、删除整站页面缓存:登录到Wordpress后台,在任意URL后面加上?r=y回车。
3、更新文章时自动刷新首页缓存:在你的Wordpress的Function.php中加入以下代码(出自:https://www.shenbogame.com/4738.html):
function newPostRefresh() { $temp=file_get_contents(“http://xxxxxxx/?r=y”); //xxxxxx自己替换 } add_action(‘publish_post’, ‘newPostRefresh’); add_action(‘edit_post’, ‘newPostRefresh’); add_action(‘delete_post’, ‘newPostRefresh’); add_action(‘comment_post’, ‘newPostRefresh’); add_action(‘edit_comment’, ‘newPostRefresh’); add_action(‘delete_comment’, ‘newPostRefresh’); add_action(‘wp_set_comment_status’, ‘newPostRefresh’); add_action(‘switch_theme’, ‘newPostRefresh’);
4、自动更新Wordpress缓存:在crontab中配置每10分钟用curl访问首页更新缓存,每天凌晨对首页或者分类页面进行更新。
*/10 * * * * curl http://www.freehao123.com/?r=y 1 1 * * * curl http://www.freehao123.com/fenye/?r=y
2、删除整站页面缓存:登录到Wordpress后台,在任意URL后面加上?r=y回车。
3、更新文章时自动刷新首页缓存:在你的Wordpress的Function.php中加入以下代码(出自:https://www.shenbogame.com/4738.html):
function newPostRefresh() { $temp=file_get_contents(“http://xxxxxxx/?r=y”); //xxxxxx自己替换 } add_action(‘publish_post’, ‘newPostRefresh’); add_action(‘edit_post’, ‘newPostRefresh’); add_action(‘delete_post’, ‘newPostRefresh’); add_action(‘comment_post’, ‘newPostRefresh’); add_action(‘edit_comment’, ‘newPostRefresh’); add_action(‘delete_comment’, ‘newPostRefresh’); add_action(‘wp_set_comment_status’, ‘newPostRefresh’); add_action(‘switch_theme’, ‘newPostRefresh’);
4、自动更新Wordpress缓存:在crontab中配置每10分钟用curl访问首页更新缓存,每天凌晨对首页或者分类页面进行更新。
*/10 * * * * curl http://www.freehao123.com/?r=y 1 1 * * * curl http://www.freehao123.com/fenye/?r=y