WordPress网站地图XML报错的修复方法

错误内容如下:error on line 1 at column 6: XML declaration allowed only at the start of the document

此错误处理方法1:文章源自原紫番博客-https://www.yuanzifan.com/54895.html

打开functions.php,找一下有没有 <?php开头,后面是空行什么都没有,然后跟了个 ?>文章源自原紫番博客-https://www.yuanzifan.com/54895.html

把这个删掉。文章源自原紫番博客-https://www.yuanzifan.com/54895.html

此错误处理方法2:文章源自原紫番博客-https://www.yuanzifan.com/54895.html

打开根目录下wp-blog-header.php文章源自原紫番博客-https://www.yuanzifan.com/54895.html

用如下代码替换:文章源自原紫番博客-https://www.yuanzifan.com/54895.html

  1. <?php
  2. if ( ! isset( $wp_did_header ) ) {
  3. $wp_did_header = true;ob_start();
  4. // Load the WordPress library.
  5. require_once __DIR__ . '/wp-load.php';
  6. // Set up the WordPress query.
  7. wp(); ob_end_clean();
  8. // Load the theme template.
  9. require_once ABSPATH . WPINC . '/template-loader.php';
  10. }

需要注意的是ob_start();吆喝wp_did写在一行。ob_end_clean()要和wp()写在一行。文章源自原紫番博客-https://www.yuanzifan.com/54895.html

文章源自原紫番博客-https://www.yuanzifan.com/54895.html 文章源自原紫番博客-https://www.yuanzifan.com/54895.html

站长微信
扫码添加(注明来意)
weinxin
Yuanzifan99
原梓番博客公众号
博客内容精选
weinxin
原梓番博客
 

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证
加载中...