Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use WordPress’s private_title_format and protected_title_format filters to replace or remove the prefixes shown before private and password-protected post titles. Add the callbacks in a site-specific plugin or your active theme’s supported customization file; do not edit WordPress core.

Which prefix does each filter control?

When WordPress renders a title with get_the_title() on the front end, it formats titles for two different access conditions:

Post condition Default prefix Filter Hook introduced
Status is private Private: %s private_title_format WordPress 2.8.0
A password is set Protected: %s protected_title_format WordPress 2.8.0

The %s token represents the post’s original title. The filters are separate, so changing one does not change the other.

Replace the prefixes with your own wording

Add both filters if you want different labels for the two cases. The second callback argument is the current WP_Post object, which you can use later for conditional rules.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<?php
add_filter( 'private_title_format', function ( $format, $post ) {
    return 'Members only: %s';
}, 10, 2 );

add_filter( 'protected_title_format', function ( $format, $post ) {
    return 'Password required: %s';
}, 10, 2 );

With this code, a private post titled “Quarterly report” renders as “Members only: Quarterly report”, while a password-protected post renders as “Password required: Quarterly report”. Keep the returned value as a plain sprintf()-style format string. The “format” in these hooks is not an HTML template.

Where to put the code

  • Site-specific plugin: Put the callbacks in a small plugin that belongs to the site, then activate it under Plugins. This keeps the behavior independent of the visual theme.
  • Theme customization: Add them to the active theme’s supported PHP customization mechanism. If you use a child theme, place the code in the child theme rather than a parent theme that may be replaced during an update.

Do not modify wp-includes/post-template.php; a WordPress update would overwrite that change.

Remove “Private:” or “Protected:” completely

Return only %s. WordPress will still pass the original title through, but no additional text will be prepended.

<?php
add_filter( 'private_title_format', function () {
    return '%s';
} );

add_filter( 'protected_title_format', function () {
    return '%s';
} );

Use only the filter that matches the prefix you want to remove. For example, removing private_title_format does not affect password-protected posts.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Apply different wording to selected posts

Because WordPress passes the current WP_Post as the second argument, a callback can return a different format for a post type or other post data. Always return a valid format string containing %s.

<?php
add_filter( 'private_title_format', function ( $format, $post ) {
    if ( 'course' === $post->post_type ) {
        return 'Enrolled users: %s';
    }

    return $format;
}, 10, 2 );

This example changes private titles only for the course post type and leaves the normal WordPress format unchanged elsewhere. The same pattern works with protected_title_format; additional checks can inspect fields such as the post’s category or ID.

What the filters do not change

They affect front-end title rendering

The documented filters are applied by get_the_title() only when WordPress is not in the administration area. They change titles displayed by front-end templates and theme output, not the title field or status labels in the editor, Posts screen, media lists, or other dashboard views.

They do not rename the post’s access status

A post remains private or password-protected. The callback changes the text displayed before its title; it does not alter permissions, passwords, visibility rules, or the stored title.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why the REST API may show no prefix

REST API responses intentionally omit these rendered prefixes. The posts controller temporarily applies its own callbacks to both filters and returns %s, because REST responses communicate a post’s status in machine-readable fields. The front-end customization therefore should not be expected in REST API title output. This REST override was introduced in WordPress 4.7.0.

If a JavaScript application needs to display “Private” or “Protected,” read the status or protection-related fields from the API response and add the interface text in that application.

Common mistakes and fixes

  • Returning the title without %s: WordPress uses the returned value as a sprintf() format. Keep one %s placeholder so the original title is inserted.
  • Expecting dashboard labels to change: These are front-end filters. Customize editor or list-table text separately if that is your goal.
  • Adding HTML to the format: The hook is for text formatting, not markup. Put links, spans, or other HTML in the relevant theme template and escape output appropriately.
  • Editing a core file: Core edits disappear on update. Use a plugin or theme hook instead.
  • Testing through the REST API: REST deliberately removes these prefixes, so verify the change in a front-end view that calls get_the_title().

Choosing the right approach

Goal Use Result
Rename private titles everywhere on the front end private_title_format One replacement format for private posts
Rename password-protected titles everywhere on the front end protected_title_format One replacement format for protected posts
Remove one prefix Return %s from the matching callback Original title without a prefix
Use different labels by post type or post data Inspect the second $post argument Conditional front-end formats
Change titles returned by WordPress REST endpoints These filters Not applicable; REST intentionally returns unprefixed rendered titles

For the usual site-wide front-end change, install the two-filter snippet in a site plugin, retain %s, and test one private post and one password-protected post while logged out. That changes presentation without changing either post’s security behavior.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.