Title: WP_REST_Post_Search_Handler::protected_title_format
Published: December 6, 2018
Last modified: May 20, 2026

---

# WP_REST_Post_Search_Handler::protected_title_format(): string

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#description)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#wp--skip-link--target)

Overwrites the default protected and private title format.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#description)󠁿

By default, WordPress will show password protected or private posts with a title
of “Protected: %s” or “Private: %s”, as the REST API communicates the status of 
a post in a machine-readable format, we remove the prefix.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#return)󠁿

 string Title format.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#source)󠁿

    ```php
    public function protected_title_format() {
    	return '%s';
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php#L198)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php#L198-L200)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_post_search_handler/protected_title_format/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_post_search_handler%2Fprotected_title_format%2F)
before being able to contribute a note or feedback.