Ticket #11117 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

Add hook to allow modification of SimplePie options

Reported by: nacin Owned by:
Priority: normal Milestone: 3.0
Component: Feeds Version: 2.9
Severity: normal Keywords: has-patch commit
Cc:

Description

I suggest an action is added to to the function fetch_feed() in wp-includes/feed.php. This would allow someone to add options to a SimplePie fetch without unnecessarily duplicating the function.

I also don't see a harm in allowing for different cache durations depending on the url. I would find that to be important context. So, I've also added the url as an argument to the wp_feed_cache_transient_lifetime filter.

Patch attached.

Attachments

11117_1.patch Download (561 bytes) - added by nacin 2 years ago.
11117_2.patch Download (588 bytes) - added by nacin 2 years ago.
Using do_action_ref_array
11117_3.patch Download (587 bytes) - added by nacin 2 years ago.
$url shouldn't be by reference.

Change History

nacin2 years ago

comment:1 follow-up: ↓ 2   scribu2 years ago

Should probably use do_action_ref_array() instead of do_action().

comment:2 in reply to: ↑ 1   nacin2 years ago

Replying to scribu:

Should probably use do_action_ref_array() instead of do_action().

Good call, not sure how I missed that. Will patch up as array(&$feed, &$url).

nacin2 years ago

Using do_action_ref_array

  • Keywords has-patch added

nacin2 years ago

$url shouldn't be by reference.

comment:4   ryan2 years ago

  • Milestone changed from 2.9 to 3.0
  • Keywords commit added

Trivial patch, could be committed. Not unlike #11237 from today.

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

(In [12484]) Pass the url to the 'wp_feed_cache_transient_lifetime' filter to give more context. Allow plugins to set extra options on SimplePie using the new 'wp_feed_options' action. Fixes #11117 props nacin.

Note: See TracTickets for help on using tickets.