#12: protected_title_format

The protected_title_format filter allows you to modify the text that gets prepended to a post title if it is password protected. The default is ‘Protected: [Post Title]’.

It is evaluated in get_the_title() in the wp-includes/post-template.php file.

Example:

Let’s say you’re using password-protected content in the context of it being “members-only” — that is, only members have the password(s). The following example would change the prepended text from ‘Protected: [Post Title]’ to ‘Members Only: [Post Title]’.

View the code example on Gist.

#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

Example:

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