WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 months ago

#10434 closed enhancement (fixed)

New filter request in feed.php

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

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 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 Denis-de-Bernardy4 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.

comment:2 josephscott7 months 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.

josephscott7 months ago

comment:3 SergeyBiryukov7 months ago

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

comment:4 nacin6 months ago

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

comment:5 ryan5 months ago

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

comment:6 nacin4 months 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.