Skip to content

Commit 79b5b5d

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@61108 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 5a8c207 commit 79b5b5d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/wp-includes/general-template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ function wp_title( $sep = '»', $display = true, $seplocation = '' ) {
14361436
*
14371437
* @param string[] $title_array Array of parts of the page title.
14381438
*/
1439-
$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
1439+
$title_array = apply_filters( 'wp_title_parts', ! empty( $title ) ? explode( $t_sep, $title ) : array() );
14401440

14411441
// Determines position of the separator and direction of the breadcrumb.
14421442
if ( 'right' === $seplocation ) { // Separator on right, so reverse the order.

0 commit comments

Comments
 (0)