dongshi4589 2012-09-23 10:48
浏览 54
已采纳

无法修改Wordpress中的标题信息错误[重复]

This question already has an answer here:

I am stuck with this error when trying to login to the admin panel. I can't get my head around it.

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxx/public_html/wordpress/wp-config.php:1) in /home/xxxxxx/public_html/wordpress/wp-includes/pluggable.php on line 881

pluggable.php 881:

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

header("Location: $location", true, $status);
}
endif;

I am using the latest version wordpress 3.4.2. My site seems to be working just fine but the error prevents me getting in to the login page which means I can't admin at all or uninstall the plugin (dbc backup 2) which seems to have triggered this problem. I have checked the wp.config file hunderds of times with HTML-kit tools and there is no visible whitespace at the begining nor at the end of the file. I have:

  1. Checked the whitespaces from wp-config file with HTML-Kit tools
  2. Downloaded and inserted new fresh wp-config file
  3. Disabled the plugins directory by renaming it

...and the error still remains

The only thing left for me to try is this code someone posted on wordpress forums claiming he had solved this problem by inserting the following code to the wp-config.php file:

    <?
//dont use header function in wordpress-wp_signup.php
global $domain;
global $path;
//change urlnew variable as per requirment
$urlnew = "http://".$domain.$path."/wp-admin/admin.php;

echo "<script>";
echo "location = '$urlnew';";
echo "</script>";
echo $urlnew;
?>

I am reluctant to add code as I am not familiar with html or php and I do not exactly understand how this code functions nor have detailed instructions where to place it exactly. Any better suggestions?


Themes function.php file ends like this, where should I exactly insert the code?:

// include custom widget

$temp_root = get_root_directory('include/plugin/custom-widget/custom-blog-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/custom-blog-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/custom-port-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/custom-port-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/custom-port-widget-2.php');

include_once($temp_root . 'include/plugin/custom-widget/custom-port-widget-2.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/popular-post-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/popular-post-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/contact-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/contact-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/flickr-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/flickr-widget.php'); 

$temp_root = get_root_directory('include/plugin/custom-widget/twitter-widget.php');

include_once($temp_root . 'include/plugin/custom-widget/twitter-widget.php');



// get the path for the file ( to support child theme )

function get_root_directory( $path ){

    if( file_exists( STYLESHEETPATH . '/' . $path ) ){

        return STYLESHEETPATH . '/';

    }else{

        return TEMPLATEPATH . '/';

    }

}

?>
</div>
  • 写回答

3条回答 默认 最新

  • du5910 2012-09-23 11:16
    关注

    If you have functions.php file into your current theme directory, then do as below into your functions.php file

    //allow redirection, even if your theme starts to send output to the browser
    add_action('init', 'clean_output_buffer');
    function clean_output_buffer() {
            ob_start();
    }
    

    HOW to remove BOM

    In order to remove the BOM, Lafontaine suggests using the freeware utility XVI32, a free hexadecimal editor. The editor doesn’t install, you can just run the EXE file right from the ZIP. The process is simple – just drag your "affected" PHP file (in my case wp_config.php) into XVI32 and it will open in a neat byte-grid. Then, you should see that the very first three bytes in the file are "" followed by php tag.

    If this is indeed the case, you should select each character in turn and just delete it (press the Del key). When you then save (Ctrl+S) the file, it will be completely the same as it used to be, only without the leading BOM.

    Complete Article Link: http://blog.scribz.net/2010/12/windows-live-writer-wordpress-unicode-bom-error/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思