diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index acc3d611a6ef0..2a739b594436c 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -1424,8 +1424,12 @@ function wp_title( $sep = '»', $display = true, $seplocation = '' ) { $title = __( 'Page not found' ); } + if ( ! is_string( $title ) ) { + $title = ''; + } + $prefix = ''; - if ( ! empty( $title ) ) { + if ( '' !== $title ) { $prefix = " $sep "; } @@ -1436,7 +1440,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', ! empty( $title ) ? explode( $t_sep, $title ) : array() ); + $title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) ); // Determines position of the separator and direction of the breadcrumb. if ( 'right' === $seplocation ) { // Separator on right, so reverse the order.