Filter hook 'single_post_title'

in WP Core File wp-includes/general-template.php at line 1499

View Source

single_post_title

Filter Hook
Description
Filters the page title for a single post.

Hook Information

File Location wp-includes/general-template.php View on GitHub
Hook Type Filter
Line Number 1499

Hook Parameters

Type Name Description
string $_post_title The single post page title.
WP_Post $_post The current post.

Usage Examples

Basic Usage
<?php
// Hook into single_post_title
add_filter('single_post_title', 'my_custom_filter', 10, 2);

function my_custom_filter($_post_title, $_post) {
    // Your custom filtering logic here
    return $_post_title;
}

Source Code Context

wp-includes/general-template.php:1499 - How this hook is used in WordPress core
<?php
1494  	 * @since 0.71
1495  	 *
1496  	 * @param string  $_post_title The single post page title.
1497  	 * @param WP_Post $_post       The current post.
1498  	 */
1499  	$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
1500  	if ( $display ) {
1501  		echo $prefix . $title;
1502  	} else {
1503  		return $prefix . $title;
1504  	}

PHP Documentation

<?php
/**
	 * Filters the page title for a single post.
	 *
	 * @since 0.71
	 *
	 * @param string  $_post_title The single post page title.
	 * @param WP_Post $_post       The current post.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.