[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:32:10 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 hellofromTonya):
Replying to [comment:6 apedog]:
> 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.
Aha, that makes sense. `add_settings_section()` needs the title you want
to appear in that settings page section. Pass it as a `string` or
translatable string (e.g. through `__()`).
> >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.
That makes now too. Thank you for confirming.
> 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.
It should still work fine with PHP 8, as it's a deprecation notice rather
than a Warning or Fatal Error. Glad you got it fixed in your plugin.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59365#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list