Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#10413 closed enhancement (fixed)

Allow plugins to short -circuit WP_Http::request()

Reported by: johnbillion's profile johnbillion Owned by: dd32's profile dd32
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.1
Component: HTTP API Keywords: has-patch tested
Focuses: Cc:


There is no way for plugins to add caching functionality to any of the HTTP functions (such as wp_remote_get()) in WordPress.

An easy way to add this is to provide a short-circuit option just like that found in get_option() where a plugin can hook into pre_option_{$option_name} and return a value for that option.

A simple filter which passes the arguments array and the URL will do nicely.

Attachments (1)

10413.patch (792 bytes) - added by johnbillion 15 years ago.

Download all attachments as: .zip

Change History (6)

#1 @johnbillion
15 years ago

  • Keywords has-patch added


Adds a new filter called pre_http_request which passes the arguments array and the URL of the request.

#2 @johnbillion
15 years ago

Patch updated.

Of course, we also need a way for plugins to access the result of the HTTP request (and potentially cache it), so let's add a http_response filter to the response.

15 years ago

#3 @Denis-de-Bernardy
15 years ago

  • Milestone changed from Unassigned to 2.9


Closing #10231 as dup, since this patch is better.

#4 @Denis-de-Bernardy
15 years ago

  • Keywords tested added

I'm all +1 for this patch. It fixes my own problem too.

#5 @markjaquith
15 years ago

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

(In [11758]) add some filters so that HTTP requests can be filtered. props johnbillion. fixes #10413

Note: See TracTickets for help on using tickets.