search
Homephp教程php手册利用Fix Rss Feeds插件修复WordPress的Feed显示错误,

利用Fix Rss Feeds插件修复WordPress的Feed显示错误,

今天突然有个网友留言说博客的Feed挂了,症状如下:

Chrome直接打开订阅页面显示如下:

This page contains the following errors:

error on line 1 at column 1: Document is empty

Below is a rendering of the page up to the first error.

FeedDemon提示:此Feed包含错误。

添加后也没什么影响,能正常使用。

鲜果阅读器也可阅读,但是没有获取到最新的文章。

用IE试了下,显示“文档顶层存在无效内容。”

查看源代码发现是能看到HTML格式解析后的内容,这说明WordPress的Feed输出是没有问题的,出问题的在于某个文件的格式。不过要找到是哪个文件出问题就比较难了。网上给出的解决方法大致都是这样的:

检测上、下是否有多余的回车、换行符号

1、检测 wp-config.php 文件,查看PHP主体之外的代码有无回车符;

2、同上,检测 wp-rss2.php,wp-atom.php文件,如果最近没修改过,可略过;

3、同上,检测 functions.php 文件;

4、注意 feed是有缓存的,在修改完成之后,发一篇文章,使WP程序重建feed,从而查看效果;

5、若仍然有错,可以尝试暂时关闭所有插件,更换主题等逐个排除。

把上述文件都修改了个遍,还是没有头绪。。于是装了个插件“Fix Rss Feeds”,启用后修复一下就搞定了。而且修复之后把插件删了也不会反弹~

研究了下这个插件,似乎只是修改了WordPress根目录下的wp-blog-header.php,其实只需将这个文件改为:

<&#63;php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */

if ( !isset($wp_did_header) ) {
 $wp_did_header = true;
  ob_start(); //2010-09-18 gofunnow.com added, it will Fix rss feed error "Error on line 2: The processing instruction target matching "[xX][mM][lL]" is not allowed." while burn feed from feedburner.com
 require_once( dirname(__FILE__) . '/wp-load.php' );
  ob_end_clean(); //2010-09-18 gofunnow.com added, it will Fix rss feed error "Error on line 2: The processing instruction target matching "[xX][mM][lL]" is not allowed." while burn feed from feedburner.com
 wp();
 require_once( ABSPATH . WPINC . '/template-loader.php' );
}
&#63;>&#8203;

就可以了。

您可能感兴趣的文章:

  • WordPress中使主题支持小工具以及添加插件启用函数
  • 几个优化WordPress中JavaScript加载体验的插件介绍
  • 在WordPress中使用wp-cron插件来设置定时任务
  • 8个出色的WordPress SEO插件收集
  • WordPress 插件——CoolCode使用方法与下载
  • 详解WordPress中提醒安装插件以及隐藏插件的功能实现
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools