Themes: Prevent PHP notice thrown in wp_title_parts.
The value passed to the `wp_title_parts` filter is run through `explode()`, but can be empty. This throws a PHP notice. If value of `$title` is empty, return an empty array without exploding. Props nexbridge, dhruvang21, tussendoor, michaelreetz, o-o, beee, sabernhardt, sirlouen, nimeshatxecurify, westonruter, sirlouen. Fixes #61352. Built from https://develop.svn.wordpress.org/trunk@61108 git-svn-id: http://core.svn.wordpress.org/trunk@60444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -1436,7 +1436,7 @@ function wp_title( $sep = '»', $display = true, $seplocation = '' ) {
|
||||
*
|
||||
* @param string[] $title_array Array of parts of the page title.
|
||||
*/
|
||||
$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
|
||||
$title_array = apply_filters( 'wp_title_parts', ! empty( $title ) ? explode( $t_sep, $title ) : array() );
|
||||
|
||||
// Determines position of the separator and direction of the breadcrumb.
|
||||
if ( 'right' === $seplocation ) { // Separator on right, so reverse the order.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.9-beta2-61107';
|
||||
$wp_version = '6.9-beta2-61108';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user