WordPress.org

Make WordPress Core

Opened 16 years ago

Closed 15 years ago

#1685 closed defect (bug) (invalid)

the_content_rss() incorrectly applying filters to the_content

Reported by: Kafkaesqui Owned by: rob1n
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: General Keywords:
Focuses: Cc:

Description

the_content_rss() function is not applying filters to the_content_rss, but rather to the_content. This is (of course) causing issues with default filters and plugins acting upon the_content_rss.

Line 21 in feed-functions.php should be:

$content = apply_filters('the_content_rss', $content);

Attachments (1)

1685.diff (356 bytes) - added by rob1n 15 years ago.

Download all attachments as: .zip

Change History (10)

#1 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3140]) Filter on the_content_rss. Props Kafkaesqui. fixes #1685

#2 @digory
16 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 1.6 to 2.0.1

This fix seems to have broken numerical entities. I think Line 21 should have been the same, and add a new line for Kafkaesqui's fix.

A la:

$content = apply_filters('the_content', $content);
$content = apply_filters('the_content_rss', $content);

I may be wrong, but it seems to me that apply_filters does not change the output of the_content(). Rather, apply_filters takes some filters used for the_content (namely, convert_smilies and convert_chars -- see default-filters.php) and applies them to $content for this function.

Without both of the lines I included above, ampersands come out like '&' and curly quotes and en dashes are not encoded at all. This produces bad XML.

Note how get_the_title_rss() does it. It uses apply_filters with both the_title and the_title_rss. Either it needs to look like the_content_rss() or vice versa.

#3 @digory
16 years ago

  • Cc jlavin@… added
  • Version changed from 2.0.1 to 2.0.2

In 2.0.2, it is line 25 that should be the same, with a line added above, as in the code above. Without the filters from the_content, an XML feed I created does not encode entities.

#4 @davidhouse
16 years ago

Entities come out fine without the patch for me, but perhaps we should include both filters for consistency with the_title_rss()

#5 @rob1n
15 years ago

  • Owner changed from anonymous to rob1n
  • Status changed from reopened to new

#6 @rob1n
15 years ago

  • Milestone set to 2.2
  • Status changed from new to assigned
  • Version changed from 2.0.2 to 2.1

@rob1n
15 years ago

#7 @rob1n
15 years ago

  • Keywords has-patch commit added; the_content_rss filters removed

#8 @ryan
15 years ago

We apply the_content_rss at the beginning of the function.

#9 @rob1n
15 years ago

  • Cc jlavin@… removed
  • Keywords has-patch commit removed
  • Milestone 2.2 deleted
  • Resolution set to invalid
  • Status changed from assigned to closed

Sorry, must have missed it.

Note: See TracTickets for help on using tickets.