@jwertin, where did you change that code? Is that in a core file somewhere? Can we come up with a fix to put in functions.php?
I don’t understand how/where RSS feeds are generated in WP. Have had this problem for years. Is this a genuine WP bug?
In my case, this function in feedwordpress.php seems to be the source of the problem:
/**
* syndication_comments_feed_link: Escape XML special characters in comments
* feed links
*
* @param string $link
* @return string
*
* @uses is_syndicated()
* @uses FeedWordPress::munge_permalinks()
*/
function syndication_comments_feed_link ($link) {
global $feedwordpress_the_original_permalink, $id;
if (is_syndicated() and FeedWordPress::munge_permalinks()) :
// If the source post provided a comment feed URL using
// wfw:commentRss or atom:link/@rel="replies" we can make use of
// that value here.
$source = get_syndication_feed_object();
$replacement = NULL;
if ($source->setting('munge comments feed links', 'munge_comments_feed_links', 'no') != 'no') :
$commentFeeds = get_post_custom_values('wfw:commentRSS');
if (
is_array($commentFeeds)
and (count($commentFeeds) > 0)
and (strlen($commentFeeds[0]) > 0)
) :
$replacement = $commentFeeds[0];
// This is a foreign link; WordPress can't vouch for its not
// having any entities that need to be &-escaped. So we'll do it
// here.
$replacement = esc_html($replacement);
endif;
endif;
if (is_null($replacement)) :
// Q: How can we get the proper feed format, since the
// format is, stupidly, not passed to the filter?
// A: Kludge kludge kludge kludge!
$fancy_permalinks = ('' != get_option('permalink_structure'));
if ($fancy_permalinks) :
preg_match('|/feed(/([^/]+))?/?$|', $link, $ref);
$format = (isset($ref[2]) ? $ref[2] : '');
if (strlen($format) == 0) : $format = get_default_feed(); endif;
$replacement = trailingslashit($feedwordpress_the_original_permalink) . 'feed';
if ($format != get_default_feed()) :
$replacement .= '/'.$format;
endif;
$replacement = user_trailingslashit($replacement, 'single_feed');
else :
// No fancy permalinks = no problem
// WordPress doesn't call get_permalink() to
// generate the comment feed URL, so the
// comments feed link is never munged by FWP.
endif;
endif;
if (!is_null($replacement)) : $link = $replacement; endif;
endif;
return $link;
} /* function syndication_comments_feed_link() */
This function is hacking around some WordPress issue – ‘Q: How can we get the proper feed format, since the format is, stupidly, not passed to the filter?’
A PHP Fatal error is caused by the line if ($source->setting('munge comments feed links ...
-> Call to a member function setting() on a non-object