WordPress / twentytwentytwo

Twenty Twenty-Two, the default WordPress theme that will launch with WordPress 5.9.
405 stars 92 forks source link

Try using __unstableLocation attribute to migrate over existing classic menu #348

Closed kjellr closed 2 years ago

kjellr commented 2 years ago

This PR is a quick attempt to automatically migrate over a primary menu if one was set in a classic theme.

Technically, this seems to work in my testing, but it feels weird to lean on something that's clearly labeled "unstable." 😕

To test:

  1. Start with a classic theme that uses a "Primary" menu location. (Most of the recent default themes do this).
  2. Assign a menu to that Primary location using the Customizer.
  3. Be sure to hit "Publish" to save your changes.
  4. Switch to the Twenty Twenty-Two theme.
  5. Observe that the primary menu on the front end displays the same menu you chose in step 2.

Video:

https://user-images.githubusercontent.com/1202812/150858000-74abb127-03df-4aa0-87c5-b0075bddab8e.mp4

jffng commented 2 years ago

Noting that the first issue I mentioned may have been patched in 5.9, the above test site is using 5.8.2 + Gutenberg trunk.

kjellr commented 2 years ago

Due to the problems noted above and the guidance in https://github.com/WordPress/gutenberg/issues/38166#issuecomment-1020730015, we'll close this for now. We may end up revisiting this approach later on once Gutenberg's tools better support it.