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

Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!

One thought on “#12: protected_title_format

  1. Week 1 Recap: Filters 1-12 – Filters of the Day

Leave a Reply

Your email address will not be published. Required fields are marked *