protected_title_format filter-hookWP 2.8.0

Filters the text prepended to the post title for protected posts.

The filter is only applied on the front end.

Usage

add_filter( 'protected_title_format', 'wp_kama_protected_title_format_filter', 10, 2 );

/**
 * Function for `protected_title_format` filter-hook.
 * 
 * @param string  $prepend Text displayed before the post title.
 * @param WP_Post $post    Current post object.
 *
 * @return string
 */
function wp_kama_protected_title_format_filter( $prepend, $post ){

	// filter...
	return $prepend;
}
$prepend(string)
Text displayed before the post title.
Default: 'Protected: %s'
$post(WP_Post)
Current post object.

Changelog

Since 2.8.0 Introduced.

Where the hook is called

get_the_title()
protected_title_format
wp-includes/post-template.php 140
$protected_title_format = apply_filters( 'protected_title_format', $prepend, $post );

Where the hook is used in WordPress

wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php 345
add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php 349
remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 514
add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php 521
remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1786
add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1790
remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
wp-includes/rest-api/search/class-wp-rest-post-search-handler.php 115
add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );
wp-includes/rest-api/search/class-wp-rest-post-search-handler.php 117
remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) );