Filter hook 'wp_title_parts'

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

View Source

wp_title_parts

Filter Hook
Description
Filters the parts of the page title.

Hook Information

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

Hook Parameters

Type Name Description
string[] $title_array Array of parts of the page title.

Usage Examples

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

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

Source Code Context

wp-includes/general-template.php:1439 - How this hook is used in WordPress core
<?php
1434  	 *
1435  	 * @since 4.0.0
1436  	 *
1437  	 * @param string[] $title_array Array of parts of the page title.
1438  	 */
1439  	$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
1440  
1441  	// Determines position of the separator and direction of the breadcrumb.
1442  	if ( 'right' === $seplocation ) { // Separator on right, so reverse the order.
1443  		$title_array = array_reverse( $title_array );
1444  		$title       = implode( " $sep ", $title_array ) . $prefix;

PHP Documentation

<?php
/**
	 * Filters the parts of the page title.
	 *
	 * @since 4.0.0
	 *
	 * @param string[] $title_array Array of parts of the page title.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/general-template.php
Related Hooks

Related hooks will be displayed here in future updates.