private_title_format
Filter HookDescription
Filters the text prepended to the post title of private posts. The filter is only applied on the front end.Hook Information
File Location |
wp-includes/post-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 160 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$prepend
|
Text displayed before the post title. Default 'Private: %s'. |
WP_Post
|
$post
|
Current post object. |
Usage Examples
Basic Usage
<?php
// Hook into private_title_format
add_filter('private_title_format', 'my_custom_filter', 10, 2);
function my_custom_filter($prepend, $post) {
// Your custom filtering logic here
return $prepend;
}
Source Code Context
wp-includes/post-template.php:160
- How this hook is used in WordPress core
<?php
155 *
156 * @param string $prepend Text displayed before the post title.
157 * Default 'Private: %s'.
158 * @param WP_Post $post Current post object.
159 */
160 $private_title_format = apply_filters( 'private_title_format', $prepend, $post );
161
162 $post_title = sprintf( $private_title_format, $post_title );
163 }
164 }
165
PHP Documentation
<?php
/**
* Filters the text prepended to the post title of private posts.
*
* The filter is only applied on the front end.
*
* @since 2.8.0
*
* @param string $prepend Text displayed before the post title.
* Default 'Private: %s'.
* @param WP_Post $post Current post object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/post-template.php
Related Hooks
Related hooks will be displayed here in future updates.