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