WordPress.org

Make WordPress Core

Opened 3 weeks ago

Closed 3 weeks ago

Last modified 3 weeks ago

#54418 closed defect (bug) (fixed)

Admin menu sidebar: Customizer menu item is not visible when a classic theme is active

Reported by: poena Owned by: hellofromTonya
Milestone: 5.9 Priority: high
Severity: normal Version: trunk
Component: Administration Keywords: has-patch commit
Focuses: ui Cc:

Description (last modified by poena)

When a classic, php based theme without support for full site editing is active,
the customizer menu item is not visible in the WordPress admin sidebar menu.

It is still visible in the top bar on the front of the website, when a user with enough privileges is logged in.

I believe the intention was to only hide this menu item when a theme with support for full site editing is active.

(This is without and with Gutenberg 11.9 active)

Attachments (7)

classic-theme-missing-customizer-menu-item.png (92.0 KB) - added by poena 3 weeks ago.
Missing customize menu item under Appearance
54418.diff (1.1 KB) - added by hellofromTonya 3 weeks ago.
For classic themes, leave Customize menu item at position 6 ([52069] moved it to 7).
54418-before-after.png (250.3 KB) - added by hellofromTonya 3 weeks ago.
Test Results: Can reproduce (Before). Patch 54418.diff restores the Customize menu to its original position (After).
test-report-reproducible.gif (7.3 MB) - added by hellofromTonya 3 weeks ago.
Test Report: Can reproduce as the Customize menu is not present for ALL themes
test-report-after-54418-diff.gif (9.1 MB) - added by hellofromTonya 3 weeks ago.
Test Report: After applying 54418.diff => Customize menu is restored and shows for all themes except TT2
test-report-tt2-can-show-Customize-menu.gif (5.7 MB) - added by hellofromTonya 3 weeks ago.
Test Report: TT2 with a callback to 'customize_register' does show the Customize menu.
54418.position8.diff (1.1 KB) - added by sabernhardt 3 weeks ago.
option to fix both issues

Change History (24)

@poena
3 weeks ago

Missing customize menu item under Appearance

#1 @poena
3 weeks ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


3 weeks ago

#3 @davidbaumwald
3 weeks ago

  • Keywords reporter-feedback added

Looks like the current check in trunk is wp_is_block_template_theme, which checks that a theme has a readable file at "[theme-path]/block-templates/index.html". See https://build.trac.wordpress.org/browser/trunk/wp-admin/menu.php#L219

@poena Does your current theme have this file?

#4 @poena
3 weeks ago

I tried several of the older default themes, and they do not have this HTML file.

Can we confirm that we are looking at the same version?
I tested again with trunk at Changeset 51737 (latest git commit being [74df751]).
Is this not the correct version to test against?

Theme:
https://build.trac.wordpress.org/browser/trunk/wp-content/themes/twentynineteen
https://build.trac.wordpress.org/browser/trunk/wp-content/themes/twentytwenty

Last edited 3 weeks ago by poena (previous) (diff)

#5 @sabernhardt
3 weeks ago

  • Keywords needs-patch added; reporter-feedback removed

Customize is not in the admin menu because the priority was moved from 6 to 7 (changeset 52069). In wp_widgets_add_menu, the Widgets link is set to 7. Instead of pushing both Customize and Widgets links down for everyone, the Site Editor might be better at a priority of 8 (if you specifically want both Customize and Site Editor with your block theme, having Customize come first can make sense).

Customize is also missing from the toolbar, and I have not found the reason for that yet. (The toolbar link is fine; I forgot it only shows on the front end.)

Last edited 3 weeks ago by sabernhardt (previous) (diff)

#6 @sabernhardt
3 weeks ago

  • Priority changed from normal to high

This ticket was mentioned in Slack in #core by sabernhardt. View the logs.


3 weeks ago

#8 @sabernhardt
3 weeks ago

Related ticket about changing and/or moving the (Site) Editor link: #54382

Last edited 3 weeks ago by sabernhardt (previous) (diff)

@hellofromTonya
3 weeks ago

For classic themes, leave Customize menu item at position 6 ([52069] moved it to 7).

@hellofromTonya
3 weeks ago

Test Results: Can reproduce (Before). Patch 54418.diff restores the Customize menu to its original position (After).

@hellofromTonya
3 weeks ago

Test Report: Can reproduce as the Customize menu is not present for ALL themes

@hellofromTonya
3 weeks ago

Test Report: After applying 54418.diff => Customize menu is restored and shows for all themes except TT2

@hellofromTonya
3 weeks ago

Test Report: TT2 with a callback to 'customize_register' does show the Customize menu.

#9 @hellofromTonya
3 weeks ago

  • Keywords has-patch added; needs-patch removed

Test Report

Env:

  • WordPress: latest trunk at time of this report (5.9-alpha)
  • Plugins: none
  • Theme: switched between TT2, TT1, TT0, and Twenty Nineteen
  • OS: macOS Big Sur
  • Browser: Chrome, Firefox, Safari, and Edge

Steps

Steps to reproduce:

  1. Pull the latest trunk version (or use Beta Tester plugin)
  2. Activate TT2. Notice the Customize menu does not display under "Appearance"
  3. Activate TT1. Customize menu should display under "Appearance", but it does not.
  4. Repeat with other bundled themes. Same result.

After applying 54418.diff:

  1. Activate TT2. Customize menu should not display.
  2. Activate TT1. Customize menu should display under "Appearance".
  3. Repeat with other bundled themes. Customize menu should display.

Results

I can able to reproduce the reported issue. The Customize menu item does not display for any themes.

When applying 54418.diff:

  • With TT2, works as expected, i.e. Customize menu does not display ✅
  • With TT1, menu is restored as it was in 5.8 ✅
  • With Twenty Twenty, menu is restored ✅
  • With Twenty Nineteen, menu is restored ✅

Can a block template theme also show the Customize menu?

Steps to Test:

  1. Activate TT2
  2. Add temporary testing code in the theme's functions.php file:
    /**
     * For testing purposes, add a callback to show the Customize
     * menu in position 7 in a block template theme.
     */
    add_action( 'customize_register', '__return_true' );
    
  3. Refresh the browser. Notice the Customize menu item displayed below the "Editor" menu item.

Results:
Yes, a block template theme like TT2 can show the Customize menu when there's a callback registered to 'customize_register'. Works as expected ✅

#10 @hellofromTonya
3 weeks ago

  • Keywords commit added

What's so special about position 7 in the Appearance sidebar menu?

Investigation:

  • Confirmed the Customize menu item is being added at position 7 after [52069]. That code works.
  • Changed the position to 8, which also works.
  • With 5.8.2, changed the Customize menu position from 6 to 7. Nope, it does not display.
  • With 5.8.2, changed the Themes menu position from 5 to 7. Nope, it does not display either. What?!

Conclusions:

  • The problem is not due to [52069].
  • Something in the codebase is removing (not hiding, literally removing) any Appearance submenu item from position 7.
  • Finding it will likely take time and patience to go down the rabbit hole.
  • I think this is a separate issue that deserves its own ticket.

What about this ticket and patch?

Themes without a /block-templates/index.html file show the Customizer menu item by default. Any plugin or theme that expects it in that position (for customization, relocating, or removal) will be impacted with this position change. That can be considered a breaking change.

I think restoring the original position makes sense. Marking for commit.

#11 follow-up: @sabernhardt
3 weeks ago

The Widgets link for non-block themes, added with the _admin_menu action in wp-includes/functions.php, has had position number 7 for more than 14 years and refuses to budge :)

Also, block themes have a "Styles" link at menu position 7 now (r52158). An activated Customize link at 7 would replace Styles, so that needs to be higher/later. (Still restore the default number to 6.)

#12 in reply to: ↑ 11 @hellofromTonya
3 weeks ago

Replying to sabernhardt:

Also, block themes have a "Styles" link at menu position 7 now (r52158). An activated Customize link at 7 would replace Styles, so that needs to be higher/later. (Still restore the default number to 6.)

@sabernhardt can you open a new ticket for this, i.e. to address the menu position of Customize with a block theme?

Why? This ticket and its patch are specifically to restore the menu position for non-block themes.

Thanks!

@sabernhardt
3 weeks ago

option to fix both issues

#13 follow-up: @sabernhardt
3 weeks ago

I added another patch in case it's simple enough to fix the two issues together.

If you would rather commit the first patch, however, I could open a separate ticket after the commit.

#14 @hellofromTonya
3 weeks ago

  • Owner set to hellofromTonya
  • Status changed from new to reviewing

Preparing commit.

#15 in reply to: ↑ 13 @hellofromTonya
3 weeks ago

Replying to sabernhardt:

I added another patch in case it's simple enough to fix the two issues together.

If you would rather commit the first patch, however, I could open a separate ticket after the commit.

I think you're right @sabernhardt. Going to commit your patch. Thanks!

#16 @hellofromTonya
3 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 52178:

Administration: Restores "Customize" menu item for non-block themes and moves for block themes.

For themes without non-block themes (i.e. without a /block-templates/index.html file), restores the "Customize" menu item under "Appearance" menu to its original location of 6.

For block themes, moves it to position 8, as "Styles" is in position 7 as of [52158].

Follow-up to [29026], [52069], [52158].

Props poena, davidbaumwald, sabernhardt, hellofromTonya.
Fixes #54418.

#17 @hellofromTonya
3 weeks ago

Thank you everyone for contributing! 54418.position8.diff has been committed and will ship in tomorrow's 5.9 Beta 1.

Note: See TracTickets for help on using tickets.