[wp-trac] [WordPress Trac] #59365: Deprecated notice when calling get_admin_page_title() on some dashboard pages.

WordPress Trac noreply at wordpress.org
Wed Jul 10 19:04:23 UTC 2024


#59365: Deprecated notice when calling get_admin_page_title() on some dashboard
pages.
-------------------------------------+--------------------------------
 Reporter:  apedog                   |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Administration           |     Version:
 Severity:  minor                    |  Resolution:
 Keywords:  reporter-feedback php81  |     Focuses:  php-compatibility
-------------------------------------+--------------------------------

Comment (by apedog):

 Replying to [comment:3 hellofromTonya]:
 > This means, the root cause is ''elsewhere in the call stack'' and needs
 to be fixed upstream of this function. That could be in how a plugin is
 registering its settings page, something is unsetting or setting the
 global variable to `null`, etc.

 Hello Tonya,
 The issue indeed was caused by a plugin registering a settings page.

 More specifically,
 I had used `get_admin_page_title()` as the `$title` parameter in
 `add_settings_section()`. In hindsight, this is obviously wrong, as it
 would register a different title depending on the page being visited.
 However it would only ''print'' the title when I was on the correct
 settings page, so I thought nothing of it - less static strings for me to
 keep track of.

 This worked fine up until I migrated to PHP 8+. I promptly fixed the
 "upstream" problem in my own plugin - and submitted the ticket at that
 time. I couldn't tell if this was indicative of a deeper issue or not.

 > @apedog Can you please confirm if the deprecation notice is being thrown
 on the Tools and Plugins admin page please?
 Yes, the notice would appear on built-in core pages such as Tools and
 Plugins.

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


More information about the wp-trac mailing list