#54682 closed defect (bug) (fixed)
PHP Notice when adding 'custom_header' support to block theme
| Reported by: | afragen | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 5.9 |
| Component: | Themes | Version: | 5.9 |
| Severity: | major | Keywords: | has-patch |
| Cc: | Focuses: | administration |
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.
5 years ago
#1
This ticket was mentioned in Slack in #core by afragen. View the logs.
5 years ago
This ticket was mentioned in Slack in #core by afragen. View the logs.
5 years ago
SergeyBiryukov commented on PR #2078:
5 years ago
#7
Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/52415.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Currently a PHP notice for an undefined variable
$customize_urlis reported when a plugin addsadd_theme_support('custom_header')and a block theme is the current theme.Define
$customize_urlat the beginning of the code section and outside of a conditional. That way it will be defined for all the conditionals.$customize_urlis unset after the conditionals are passed.Trac ticket: https://core.trac.wordpress.org/ticket/54682