[wp-trac] [WordPress Trac] #61352: PHP deprecation notice in wp_title()

WordPress Trac noreply at wordpress.org
Sat Nov 1 22:41:38 UTC 2025


#61352: PHP deprecation notice in wp_title()
--------------------------+------------------------
 Reporter:  nexbridge     |       Owner:  joedolson
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  6.9
Component:  Themes        |     Version:  6.5.5
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------

Comment (by SirLouen):

 Replying to [comment:31 TobiasBg]:
 > Using `empty()` in [61108] is not ideal.
 > `$title` is a string, so this can instead be simplified to a string
 comparison `'' !== $title`, saving internal variable type checks.

 Afaik, `null` is not `''`. If `$title` is empty, it doesn't trigger the
 deprecated notice, only if `$title` is `null`. With a `empty` check, you
 solve both cases.

 On the other hand, `is_string` as @sabernhardt suggests does the trick,
 but from my perspective, is less readable than `empty` for what we are
 trying to signal here (not null ideally, and preferably not empty string).

 I would suggest to leave this fixed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61352#comment:33>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list