Add reply by email link to RSS feed for each post

I came across this post https://ethanmarcotte.com/wrote/replyin/ where author added mailto email link to each blog post in RSS

As per https://ethanmarcotte.com/wrote/feed.xml that portion of XML output looks like this:

<entry>
<content>
........<p><a href="mailto:listener+rss@ethanmarcotte.com?subject=Reply%20to:%20“Bookiversary.”">Reply via email</a></p> </content>
</entry>

I don’t know PHP - just some basics I learned by dealing with WordPress, however, I become curious how it was done and after some googling I came across the following PHP snippet from

https://meyerweb.com/eric/thoughts/2020/09/04/reply-links-in-rss-items/#comment-3711850/

I don’t need the part of the script that deals with comments ( I have commenting off). I am only trying to implement the portion that pulls in post title with get_the_title()

// add 'reply via email' to all RSS feeds
function add_content_to_all_feeds($content) {

	  $after = '<p><a href="mailto:test@gmail.com?subject=In%20reply%20to%20%22' . str_replace(' ', '%20', get_the_title()) . '%22">Reply via email</a></p>';

	if (is_feed()) {

		return $content . $after;

	} else {

		return $content;
   }

}
add_filter('the_content_feed', 'add_content_to_all_feeds');

and gives the following output:

<p><a href="mailto:test@gmail.com?subject=In%20reply%20to%20%22This%20is%20test%20post%20for%20RSS%20feed%22">Reply via email</a></p>]]></content:encoded>

Question: In the above output (first link) the post title is output surrounded by double quotes “Bookiversary.” and in my output it is surrounded by %22 - it appears it is not converted into double quotes. Why?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.