private_title_format

Filters the text prepended to the post title of private posts.

Description

apply_filters( 'private_title_format', (string) $var, (WP_Post) $post ); 

The filter is only applied on the front end.

Parameters (2)

0. $var (string) => __( 'Private: %s' )
Text displayed before the post title. Default Private: %s..
1. $post (WP_Post)
Current post object.

Usage

To run the hook, copy the example below.
  1. $var = apply_filters( 'private_title_format', $var, $post ); 
  2.  
  3. if ( !empty( $var ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the private_title_format callback 
  2. function filter_private_title_format( $var, $post ) { 
  3. // make filter magic happen here... 
  4. return $var
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'private_title_format', 'filter_private_title_format', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'private_title_format', 'filter_private_title_format', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/post-template.php  
  1. $private_title_format = apply_filters( 'private_title_format', __( 'Private: %s' ), $post );