WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 6 years ago

#10434 closed enhancement (fixed)

New filter request in feed.php

Reported by: mogman1 Owned by: nacin
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.5
Component: Feeds Keywords: has-patch commit
Focuses: Cc:

Description

When writing a plugin that works with the URLs in the RSS feeds, I noticed that one of the functions used by the RSS feed generator, "self_link" in wp-includes/feed.php does not have a filter associated with it. I had to manually modify the function in order to get the behaviour I desired.

The other functions used by the feed generator (the_permalink_rss, comments_link, the_guid, etc) all have filters associated with them either directly or indirectly and it would be nice for this one to have a filter placed on it as well.

Attachments (1)

10434.diff (471 bytes) - added by josephscott 7 years ago.

Download all attachments as: .zip

Change History (7)

#1 @Denis-de-Bernardy
10 years ago

  • Milestone Unassigned deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Only feed_link I found was in get_feed_link(), and it has a filter. Please re-open with feedback if this is still current in trunk.

#2 @josephscott
7 years ago

  • Cc josephscott added
  • Keywords has-patch added
  • Milestone set to Awaiting Review
  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Version set to trunk

The self_link() function is used in feed-atom.php, feed-rss2-comments.php, feed-rss2.php for the self item in the feed. What I'm seeing with the PuSHPress plugin (for PubSubHubbub) is that the inclusion of $_SERVER['REQUEST_URI'] is triggering some odd looking self URLs in some cases. I've seen URLs for do_wp_cron, /wp-admin/, etc. Those are clearly not the self reference link for the feed.

Adding a filter would allow the PuSHPress plugin to ensure that the self link is set to the correct feed URL. I'm including a simple patch that applies a 'self_link' filter to the value, then escapes it, then outputs the value.

@josephscott
7 years ago

#3 @SergeyBiryukov
7 years ago

  • Component changed from Plugins to Feeds
  • Keywords RSS filter feeds removed

#4 @nacin
7 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.6

#5 @ryan
7 years ago

This has been soaking on wordpress.com for 5 weeks.

#6 @nacin
6 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from reopened to closed

In 23521:

Add self_link filter to self_link(). props josephscott. fixes #10434.

Note: See TracTickets for help on using tickets.