0
我想通过使用template_redirect的WordPress中的URL加载插件的特定文件。该文件被正确显示,但是发送的报头是404,而不是200Wordpress插件template_redirect抛出404
在插件的代码:
add_filter('query_vars','plugin_add_jb');
function plugin_add_jb($vars) {
$vars[] = 'jb_ajax';
return $vars;
}
add_action('template_redirect', 'plugin_jb_check');
function plugin_jb_check() {
if(intval(get_query_var('jb_ajax')) == '1') {
$jb_action = $_GET['action'];
if($jb_action == 'refer') {
include('./wp-content/plugins/JobBounties/ajax_refer.php');
}
elseif ($jb_action == 'refer_post') {
include('./wp-content/plugins/JobBounties/ajax_refer_post.php');
}
exit;
}
}
任何人有任何想法,为什么它抛出404?
您是否尝试过首先检查'404',然后删除该标志并添加'header(“HTTP/1.1 200 OK”);'? – 2013-04-09 15:44:33