I am trying to debug why my page feed with is returning empty.
Here’s the URL for same,
I’m seeing the following output here,
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" > <channel> <title> Comments on: Checking Account </title> <atom:link href="http://localhost/design-patterns/code-improvement/feed/" rel="self" type="application/rss+xml" /> <link>http://localhost/design-patterns</link> <description>Just another WordPress site</description> <lastBuildDate>Mon, 26 Apr 2021 06:33:50 +0000</lastBuildDate> <sy:updatePeriod> hourly </sy:updatePeriod> <sy:updateFrequency> 1 </sy:updateFrequency> </channel> </rss>
As you see there are no
<item> tags present, inspite of there being content in that page.
That is because,
while ( have_comments() ) : at
but the fact is
wp-includesfeed-rss2-comments.php should never have been called, instead I needed
wp-includesfeed-rss2.php which calls
while ( have_posts() ) :
While debugging I reached till
In there the function which was getting called was
do_feed_rss2. Now according to the doc if the feed is for comments the
$for_commentsflag should be
What I observed in my case is it was giving
true value and since the page had no comments the feed was returning to be empty.
So I started searching for the
do_action call for
do_feed_rss2 , thinking that is where the value must be getting set from, but all i could find is this,
Can anybody help me finding why is this
$for_comments flag getting set as