#24: login_messages

The login_messages filter allows you to modify various messages shown on the login screen.

It is evaluated in login_header() in the wp-login.php file.

Messages include:

  • ‘Session expired. Please log in again. You will not move away from this page.’
  • ‘You are now logged out.’
  • ‘User registration is currently not allowed.’
  • ‘Check your e-mail for the confirmation link.’
  • ‘Check your e-mail for your new password.’
  • ‘Registration complete. Please check your e-email.’
  • You have successfully updated WordPress! Please log back in to experience the awesomeness.

login_messages accepts a single argument taking the form of a string containing the message for the context.

It’s important to remember that login_messages is evaluated as a string, not an array of messages like elsewhere in Core. The string delivered is determined based on the provided context in the query string. If you want to modify the message as stored in the WP_Error object, take a look at the wp_login_errors filter.

For more information on messages and their respective contexts, see the login switch case in wp-login.php


Let’s say you want to remove the hyphens in ‘e-mail’ for any of the checkemail context, because maybe you’re kind of a nut for AP Style. The following checks for the existence of ‘e-mail’ in the message string and replaces it with ’email’.

View the code example on Gist.

#23: wp_sprintf_l

The wp_sprintf_l filter allows you to modify the default list item separators used in lists employing the %l specifier — such as when using the the_taxonomies() template tag. When we say “separators”, we’re talking about the punctuation and/or punctuation + words used to grammatically space items in a list.

For example:

  • If there are two taxonomy terms, the separator would be ‘ and ‘, e.g. ‘Something and Something Else’
  • If there are three or more terms, the separator ‘, ‘ would be used up until the last term, then the separator used would be ‘, and ‘, e.g. ‘Something, Something Else, and Something Else Again’

It is evaluated in wp_sprintf_l() in the wp-includes/formatting.php file. wp_sprintf_l() exists to make these default item separators localizable for different languages.

Important note: You should exercise caution modifying the default separators as translators use them as a guide.

wp_sprintf_l accepts a single argument that takes the form of an array. Each key/value pair in the array specifies a different type of list item separator:

  • 'between' => ', '
  • 'between_last_two' => ', and '
  • 'between_only_two' => ' and '


Let’s say you’re one of those people who just can’t stand the serial/Oxford comma, the following will modify the between_last_two key in the wp_sprint_l separators array.

View the code example on Gist.

#22: http_request_timeout

The http_request_timeout filter allows you to set the http request timeout duration in seconds.

It is evaluated in WP_http::request() method, which has a helper function, wp_remote_request() in the wp-includes/http.php file.

http_request_timeout accepts a single argument in the form of an integer that specifies the timeout duration in seconds.


The following example extends the timeout duration from 5 seconds to 30 seconds.

View the code example on Gist.