将此代码复制到php文件中,将此文件复制到插件文件夹中,然后在WordPress的后端将其激活。我希望这有帮助,但我不测试它,写在草稿上。
<?php
/**
* Plugin Name: Non-UTF characters in RSS feed
* Plugin URI: http://wordpress.stackexchange.com/questions/37845/non-utf-characters-break-rss-feed/
* Description: Filter content for unicode characters
* Version: 1.0.0
* Author: Frank Bültge
* Author URI: http://bueltge.de
* License: GPLv3
*/
// This file is not called from WordPress. We don\'t like that.
! defined( \'ABSPATH\' ) and exit;
foreach ( array( \'the_content_rss\', \'the_excerpt_rss\', \'the_title_rss\', \'comment_text_rss\' ) as $filter )
remove_filter( $filter, \'filter_non_utf8_chars\', 0 );
function filter_non_utf8_chars( $content ) {
return htmlentities2( $content );
}
?>