Filter hook 'document_title_parts'

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

View Source

document_title_parts

Filter Hook
Description
Filters the parts of the document title. }

Hook Information

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

Hook Parameters

Type Name Description
array $title { The document title parts.

Usage Examples

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

function my_custom_filter($title) {
    // Your custom filtering logic here
    return $title;
}

Source Code Context

wp-includes/general-template.php:1283 - How this hook is used in WordPress core
<?php
1278  	 *     @type string $page    Optional. Page number if paginated.
1279  	 *     @type string $tagline Optional. Site description when on home page.
1280  	 *     @type string $site    Optional. Site title when not on home page.
1281  	 * }
1282  	 */
1283  	$title = apply_filters( 'document_title_parts', $title );
1284  
1285  	$title = implode( " $sep ", array_filter( $title ) );
1286  
1287  	/**
1288  	 * Filters the document title.

PHP Documentation

<?php
/**
	 * Filters the parts of the document title.
	 *
	 * @since 4.4.0
	 *
	 * @param array $title {
	 *     The document title parts.
	 *
	 *     @type string $title   Title of the viewed page.
	 *     @type string $page    Optional. Page number if paginated.
	 *     @type string $tagline Optional. Site description when on home page.
	 *     @type string $site    Optional. Site title when not on home page.
	 * }
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.