做
function add_admin_qs($url){
if ( is_user_logged_in() ) {
return add_query_arg(\'nocfcache\', \'true\', $url);
}
}
add_action( \'plugins_loaded\', function(){
if ( is_user_logged_in() ) {
add_filter( \'home_url\', \'add_admin_qs\', 11, 1);
add_filter( \'post_link\', \'add_admin_qs\', 10, 1);
add_filter( \'page_link\', \'add_admin_qs\', 10, 1);
add_filter( \'post_type_link\', \'add_admin_qs\', 10, 1);
add_filter( \'category_link\', \'add_admin_qs\', 11, 1);
add_filter( \'tag_link\', \'add_admin_qs\', 10, 1);
add_filter( \'author_link\', \'add_admin_qs\', 11, 1);
add_filter( \'day_link\', \'add_admin_qs\', 11, 1);
add_filter( \'month_link\', \'add_admin_qs\', 11, 1);
add_filter( \'year_link\', \'add_admin_qs\', 11, 1);
}
});
我认为主要的问题是您在WP加载时加载代码,可能是在您真正登录WP之前。