#54682 closed defect (bug) (fixed)
PHP Notice when adding 'custom_header' support to block theme
Reported by: | afragen | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | major | Version: | 5.9 |
Component: | Themes | Keywords: | has-patch |
Focuses: | administration | Cc: |
Description
When adding add_theme_support( 'custom_header' );
to a block theme in 5.9-beta a PHP warning is thrown on wp-admin/menu.php:231
as $customize_url
hasn't been defined.
As $customize_url
is defined inside a conditional that may not fire and is unset about 20 lines down the code, it should be defined outside of the conditional.
Change History (7)
This ticket was mentioned in PR #2078 on WordPress/wordpress-develop by afragen.
3 years ago
#1
This ticket was mentioned in Slack in #core by afragen. View the logs.
3 years ago
#3
@
3 years ago
- Component changed from General to Themes
- Milestone changed from Awaiting Review to 5.9
This ticket was mentioned in Slack in #core by afragen. View the logs.
3 years ago
#6
@
3 years ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 52415:
SergeyBiryukov commented on PR #2078:
3 years ago
#7
Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/52415.
Note: See
TracTickets for help on using
tickets.
Currently a PHP notice for an undefined variable
$customize_url
is reported when a plugin addsadd_theme_support('custom_header')
and a block theme is the current theme.Define
$customize_url
at the beginning of the code section and outside of a conditional. That way it will be defined for all the conditionals.$customize_url
is unset after the conditionals are passed.Trac ticket: https://core.trac.wordpress.org/ticket/54682