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 on the front end. Add the code to a site plugin or your theme’s supported customization mechanism; do not edit WordPress core files.

Choose the filter for the kind of post

WordPress prepends Private: to titles for posts with the private status, and Protected: to password-protected posts. These are separate cases, controlled by separate filters:

Post type of restriction Filter Default format
Private status private_title_format Private: %s
Password-protected protected_title_format Protected: %s

Both filters have existed since WordPress 2.8.0. The official references describe them as filters for text prepended to post titles: private_title_format and protected_title_format.

Replace a prefix with your own wording

Add a callback for the filter or filters you want to change. Keep %s in the returned format string: WordPress substitutes the original post title for that placeholder.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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 these callbacks, a private post titled “Site update” renders as “Members only: Site update”; a password-protected post with the same title renders as “Password required: Site update.” To change only one kind of prefix, use only its corresponding add_filter() block.

Remove a prefix entirely

Return %s by itself to show the original title without added wording. This example removes both prefixes:

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

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

To remove only one, keep only that filter. The placeholder is still needed so the original title is included.

Where to add the code

Put the callbacks in a site plugin or add them through your active theme’s supported customization mechanism. A site plugin keeps the change independent of the theme; theme-based code may stop running if you switch themes. Do not change wp-includes/post-template.php: a WordPress update can overwrite core-file edits.

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

These filters set a plain-text format string, not an HTML template. If you need markup around a title, handle that in the relevant theme template rather than returning HTML from the filter.

Make the wording conditional for selected posts

Each callback can receive the current WP_Post as its second argument. Use it when the wording should vary by post type or other post data. For example, this changes the private-post prefix for pages while keeping the default format for other private posts:

add_filter( 'private_title_format', function ( $format, $post ) {
    if ( 'page' === $post->post_type ) {
        return 'Members-only page: %s';
    }

    return $format;
}, 10, 2 );

The callback must return a valid sprintf()-style format string. Return $format for posts whose existing wording should remain unchanged. The post-object argument was added to support more targeted changes.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Know where the customized title appears

Front end

The filters affect title rendering through get_the_title() on the front end. They do not rename the labels in the WordPress editor or other admin screens; the title itself is not being changed in the database.

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.

REST API

Do not expect these custom prefixes in REST API rendered titles. The posts controller temporarily overrides both filters and removes the prefix from REST title output. REST responses communicate post status in machine-readable fields instead. WordPress introduced this behavior in 4.7.0; see the REST API posts reference.

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.