无法在wordpress中修改标题信息
我有一个问题,无法在wordpress上修改标题信息 警告:无法修改标题信息-标题已由/home/sixtydev/public_html/voxxydev/wp content/themes/voxxy/header.php:15)在/home/sixtydev/public_html/voxxydev/wp includes/pluggable.php第865行发送 我的重定向代码是:无法在wordpress中修改标题信息,wordpress,header,location,Wordpress,Header,Location,我有一个问题,无法在wordpress上修改标题信息 警告:无法修改标题信息-标题已由/home/sixtydev/public_html/voxxydev/wp content/themes/voxxy/header.php:15)在/home/sixtydev/public_html/voxxydev/wp includes/pluggable.php第865行发送 我的重定向代码是: if(isset($_GET['qry']) && !empty($_GET['qry'
if(isset($_GET['qry']) && !empty($_GET['qry'])){
$swl = mysql_query("update wp_share_idea set image".$_GET['qry']."='' where userId='".$delId."'");
wp_redirect("http://60degreedeveloper.info/voxxydev/user-profile/?msg='".$delId."'");
exit;
}
my header.php代码:
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package WordPress
* @subpackage Voxxy
* @since Voxxy 1.0
*/
?><html>
<head>
<title>Voxxy</title>
<link rel="profile" href="http://gmpg.org/xfn/11"/>
line no: 15:: <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url');?>"/>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"/>
function wp_redirect($location, $status = 302) {
global $is_IIS;
$location = apply_filters('wp_redirect', $location, $status);
$status = apply_filters('wp_redirect_status', $status, $location);
if ( !$location ) // allows the wp_redirect filter to cancel a redirect
return false;
$location = wp_sanitize_redirect($location);
if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
status_header($status); // This causes problems on IIS and some FastCGI setups
line no:865:- header("Location: $location", true, $status);
}
我不知道问题出在哪里。
提前感谢
wp\u重定向
只有在Wordpress中首先生成输出时才有效。它通过在输出中设置http头来工作。一旦其他东西产生了一些输出,该方法就不再有效
在您的情况下,无论您在pluggable.php中调用重定向代码的位置,都会在调用get\u header()
之后发生
您必须在调用标头之前移动此代码,或者使用javascript函数重定向用户
您也不应该对未初始化的$\u GET变量在数据库上运行
update
查询。如果@cpilko解决方案不起作用(他可能完全正确),但是-
关于PHP文件本身,wordpress存在一个已知的问题。
您需要确保在开始之前没有空字符/空格/回车符
你需要检查你所有的主题文件和插件
关于结束标记?>
-您需要确保它存在(是的,一些插件开发人员忽略了这一点)
请在此处阅读更多信息:
在99%的情况下,这是罪魁祸首。如果将
bloginfo('stylesheet\u uri')
更改为print get\u stylesheet\u directory\u uri()
和
bloginfo('pingback\u url')
要打印get\u bloginfo('pingback\u url')
试试ob_start();
$status = apply_filters( 'wp_redirect_status', $status, $location );
if ( ! $location )
return false;
$location = wp_sanitize_redirect($location);
if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
status_header($status); // This causes problems on IIS and some FastCGI setups
header("Location: $location", true, $status);
return true;
}
endif;
在根文件wp_config.php的顶部,先生,您是我心目中的英雄。刚才也有同样的问题,我想不出来。你的回答让我想到,在发送
$\u POST/$\u get
数据进行处理之前,我可能正在执行get_header()
和get_sidebar()
,其中包括一个wp_重定向()
。谢谢!您对所需的结束标记?>
不正确。状态:“最好省略文件末尾的结束PHP标记。”