#25: the_modified_date

The the_modified_date filter allows you to modify the modified date output when used for a post inside the Loop.

It is evaluated in the the_modified_date() template tag in the wp-includes/general-template.php file. Template tags must be used inside the Loop.

the_modified_date accepts 4 arguments:

  1. string $the_modified_date The date the post was modified
  2. string $d The date format, if empty it defaults to the value of date_format option
  3. string $before What to output before the date
  4. string $after What to output after the date


The following wraps the modified date in emphasis tags on output.

View the code example on Gist.

#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.

#18: pre_link_description

The pre_link_description filter allows you to do modify a link’s description before it is saved into the database.

It is evaluated in sanitize_bookmark_field() under the db context, which is used in wp_insert_link() in the wp-admin/includes/bookmark.php file.

You should run any string text you return via this filter through esc_attr() as it’s used in the link’s title attribute. See the note below about slashing link data.

pre_link_description accepts a single argument in the form of a string containing the link description/title attribute.

Side note: Link data coming out of the database via wp_insert_link() is unslashed via wp_unslash() in 3.6+ (stripslashes_deep() in older versions) but the data going in will automatically be slashed via mysql_real_escape_string() in the $wpdb->insert|prepare methods (thanks Rarst for the assist!). In other words, this is a case where Core handles slashing the data for you.


Let’s say you run a site that still actively uses the Link Manager to build a blog roll or links list, and let’s say you want to subtly indicate when a link was last edited. The following replaces the link description with the last-edited date and time which is then saved in the database.

View the code example on Gist.