#11: http_response

The http_response filter makes it possible to manipulate the response array returned by a wp_remote_request()/WP_Http::request() call.

It is evaluated in the private WP_Http::_dispatch_request() method, which is called by WP_Http::request() in wp-includes/class-http.php file.

The http_response filter accepts three arguments:

  1. array $response The response array
  2. array $args An array of arguments (see wp_remote_request() in wp-includes/http.php)
  3. string $url The URL to request


Let’s say you’re pinging some external site and displaying the body of the requested site somewhere but you only want to display the content if it is actually valid — say, based on whether the status code is 200, 301, or 302. For any other status code, you want to override the body of the http response with some general template.

View the code example on Gist

#4: the_weekday_date

The the_weekday_date filter makes it possible to change the displayed day of the week a post was published, when the function of the same name — the_weekday_date() — is used inside the Loop.

It is located in wp-includes/general-template.php and the_weekday_date() only outputs the day if the current post’s weekday is different from the previous one output (why this would be needed, I have no idea).

The filter accepts three arguments:

  1. string $the_weekday_date The day of the week
  2. string $before Text or markup before
  3. string $after Text or markup after

The original value of $the_weekday_date is determined using a chain of functions to snag the localized day of the week:

  • the get_weekday() method of the WP_Locale class
  • mysql2date()


Let’s say you wanted to convert the day ‘Saturday’ into pirate-speak, something like ‘SatARRRday’ and were using the_weekday_date() to output it in the Loop.