I have been requested to disable all text encoding on a specific WordPress RSS feed, so a sentence that outputs like this
She said “oh, you’re lost”
would output like this
She said "oh, you're lost"
This is not just about the quotes, but all encoded chars. I'm checking for the feed with is_feed('feed-handle')
, and if it is detected, I'm disabling wptexturizer globally with add_filter( 'run_wptexturize', '__return_false' )
.
After that, I have the two functions below working on the content and the excerpt.
add_filter( 'the_content_rss', [ $this, 'modify_feed_content' ] );
add_filter( 'the_excerpt_rss', [ $this, 'modify_feed_excerpt' ] );
public function modify_feed_content( $content ) {
$content = wp_specialchars_decode( $content ); // decodes remaining html entities
return $content;
}
public function modify_feed_excerpt( $excerpt ) {
$excerpt = strip_tags( $excerpt ); // remove html tags
$excerpt = wp_specialchars_decode( $excerpt ); // decodes remaining html entities
return $excerpt;
}
I can see it working ok, but I'm still getting some encoded chars, like  
, and a few others. I tried chatGPT, but it answered basically with all I have already done.
Any insight on what I'm missing? Any help is very much appreciated.
Thank you all.
Update:
What got me the best results was to add the add_filter( 'run_wptexturize', '__return_false' )
call to the header of the custom rss feed file.