Make WordPress Core

#63333 closed defect (bug) (duplicate)

deprecated message using default wp theme 20-13

Reported by: neo2k23's profile neo2k23 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

I get a deprecated message on using a default wp theme 20-13

$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );

<b>Deprecated</b>:  explode(): Passing null to parameter #2 ($string) of type string is deprecated in <b>/home/public_html/wp-includes/general-template.php</b> on line <b>1441</b><br />
Default theme | Een andere Demo Blog websites site</title>

apparently when line 1439 is reached $title is and can be empty.

changing the code to

	if ( !empty( $title ) )  $title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
	else $title_array  = array();

fixes the issue. Please adapt. Thank you

Change History (9)

#1 @neo2k23
11 months ago

line 1441 should be 1439. I already change to the new code and reverted back leaving to empty lines just to regenerate the message for posting this issue. Apologies for this mistake. The correct linenumber that generates the issue in the unmodified file is 1439

#2 @audrasjb
11 months ago

  • Component changed from General to Bundled Theme
  • Keywords reporter-feedback added
  • Version trunk deleted

Hello and thanks for the report.
Could you please share the steps to help reproduce the deprecated message?
Thanks

#3 @neo2k23
11 months ago

@audrasjb

I have debug mode enabled, using a multisite with using php 8.2.28 and activate the default wp 20-13 theme and view the home page. In the browser title tab just before the correct title you see the deprecated message.

if i enable tracking i get this

	[22-Apr-2025 12:46:53 UTC] PHP Deprecated:  explode(): Passing null to parameter #2 ($string) of type string is deprecated in /home/public_html/wp-includes/general-template.php on line 1439
	[22-Apr-2025 12:46:53 UTC] Array
	(
		[0] => Array
			(
				[file] => /home/public_html/wp-content/themes/twentythirteen/header.php
				[line] => 16
				[function] => wp_title
			)

		[1] => Array
			(
				[file] => /home/public_html/wp-includes/template.php
				[line] => 810
				[args] => Array
					(
						[0] => /home/public_html/wp-content/themes/twentythirteen/header.php
					)

				[function] => require_once
			)

		[2] => Array
			(
				[file] => /home/public_html/wp-includes/template.php
				[line] => 745
				[function] => load_template
			)

		[3] => Array
			(
				[file] => /home/public_html/wp-includes/general-template.php
				[line] => 48
				[function] => locate_template
			)

		[4] => Array
			(
				[file] => /home/public_html/wp-content/themes/twentythirteen/index.php
				[line] => 17
				[function] => get_header
			)

		[5] => Array
			(
				[file] => /home/public_html/wp-includes/template-loader.php
				[line] => 106
				[args] => Array
					(
						[0] => /home/public_html/wp-content/themes/twentythirteen/index.php
					)

				[function] => include
			)

		[6] => Array
			(
				[file] => /home/public_html/wp-blog-header.php
				[line] => 19
				[args] => Array
					(
						[0] => /home/public_html/wp-includes/template-loader.php
					)

				[function] => require_once
			)

		[7] => Array
			(
				[file] => /home/public_html/index.php
				[line] => 17
				[args] => Array
					(
						[0] => /home/public_html/wp-blog-header.php
					)

				[function] => require
			)

	)

#4 @SirLouen
11 months ago

  • Keywords needs-testing-info added

Reproduction Report

Description

This report can't validate that the issue can be reproduced.

Environment

  • WordPress: 6.8
  • PHP: 8.2.10-dev
  • Server: PHP.wasm
  • Database: WP_SQLite_Translator (Server: 5.5 / Client: 3.40.1)
  • Browser: Chrome 135.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Thirteen 4.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0
    • WP Debugging 2.12.2

Reproduction Steps

  1. Create a new Playground with PHP 8.2 and Twentythirteen
  2. Enable WP Debugging plugin full
  3. Check homepage
  4. ❌ No deprecation errors

Actual Results

  1. ❌ Can't reproduce the deprecation notice

Additional Notes

@neo2k23
Please check the WP Playground and see if you can reproduce this by yourself. This is a clean, brand-new WordPress environment to test this kind of thing. When we cannot reproduce things, we assume that the problem relies on the user's host settings typically (or a WP different version, although you have a couple of versions to check there).

Question: Have you done some sort of special edit to the template, that removes head title or something? I've also tried removing title and subtitles in General, but still, I can't get that error.

#5 @neo2k23
11 months ago

i did not edit or change any code. i just turned on by accident the default 20-13 theme and got the error.

I just tested this in my local host server and it does not happen. I guess its somehow related to the multisite which is a old one (2012).

Please close the issue. Sorry for this i should have tested this on my local server first.

#6 @SirLouen
11 months ago

  • Keywords reporter-feedback needs-testing-info removed
  • Resolution set to invalid
  • Status changed from new to closed

Ok, thanks for the prompt response. Closing.

#7 @neo2k23
11 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

@SirLouen @audrasjb

I can consistenty recreate the issue in https://playground.wordpress.net/?php=8.2&wp=6.8&networking=yes&language=&multisite=no&random=30295bbjxfg

create a static page called blog and set that page as your blog page in the wp reading settings

Make sure the home page is set to -- select -- in the wp reading settings.

Now view thefront of the website. The browser tab now has the issue and shows first the deprecated message.

https://share.zight.com/d5ukE8XA

https://share.zight.com/d5ukE8XA

Last edited 11 months ago by neo2k23 (previous) (diff)

#8 @SirLouen
11 months ago

  • Keywords has-testing-info needs-patch added

Got it.

#9 @sabernhardt
11 months ago

  • Component changed from Bundled Theme to Themes
  • Description modified (diff)
  • Keywords has-testing-info needs-patch removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

The deprecation notice is already reported on #61352, if you would like to follow that.

The message can display with any theme from Twenty Ten to Twenty Fourteen—and probably many more of the directory themes that use the wp_title function.

Note: See TracTickets for help on using tickets.