-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Description
What problem does this address?
When you create a new navigation menu from a classic menu then a new wp_navigation CPT is created, which is already populated with the content of the classic navigation. The upshot of this is that as soon as the classic navigation is created the fallback behaviour of the block is changed and the classic menu is used instead of page list (as described in #42799)
What is your proposed solution?
There are two potential solutions:
1. Create the classic navigation as a "draft" CPT.
I tried this approach, simply changing the status of the record from "published" to "draft" when the CPT is created (in use-create-navigation-menu.js). This does change the new CPTs to be draft, but the post doesn't get marked as dirty in the entity saving flow. We would need to update the enitity saving flow to understand draft posts. I don't know how complex this would be.
2. Create the classic menu empty and then replace inner blocks with the classic navigation items
Alternatively we could create the new "classic" wp_navigation CPT empty (which is what happens when you create a new navigation menu normally), and then populate the inner blocks with the navigation items that were returned from the API. This should mark the block as "dirty" for the entity saving flow, so it feels like it should be a simpler approach. I made a start here: #43190