Family Encyclopedia >> Electronics

How to Customize Private and Protected Post Title Prefixes in WordPress

As a seasoned WordPress developer with years of experience managing multi-author sites and personal blogs, I've often needed to tweak the default 'Private:' and 'Protected:' prefixes that appear before post titles. These labels are great for security, but they can feel bland—especially on family blogs or collaborative sites where you want a personal touch.

For instance, imagine transforming 'Protected: Family Update' into 'Family Only: Family Update.' It's a simple change that enhances readability and branding without compromising functionality.

In this guide, I'll walk you through the straightforward process to customize these prefixes using your theme's functions.php file. This method is reliable, battle-tested across numerous client projects, and fully reversible.

Customizing the Protected Post Prefix

Add the following code snippet to your active theme's functions.php file (back up first, and use a child theme to avoid update issues):

function change_protected_title_prefix() {
    return 'Family Only: %s';
}
add_filter( 'protected_title_format', 'change_protected_title_prefix' );

Customizing the Private Post Prefix

Similarly, insert this code for private posts:

function change_private_title_prefix() {
    return 'Editors Only: %s';
}
add_filter( 'private_title_format', 'change_private_title_prefix' );

Feel free to get creative—replace the example text with anything that fits your site's voice, like 'VIP Access:' or 'Members Only:'. This customization is a quick win for polishing your blog's professional appearance.