I want to move this section ( menus ) into a new panel or section, in the wordpress customizer options.
Note:
- Menus is one of the default options added by wp.
- Header is one new panel created by me.
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityThe customizer is divided into panels, then sections, then controls. You cannot move a panel inside another panel. However, you can move sections from one panel to another. In this case you can move the sections inside "Menus" to the "Header panel" like this:
$wp_customize->get_section ('AAA')->panel = 'BBB';
Where AAA is the slug of the section you want to move and BBB is the slug of the panel where you want it to show up. You can find the slugs in the ID's of the customizer html (use the browser's inspector)
Once a panel is empty, you can remove it with:
$wp_customize->remove_pange ('CCC')
The slug for the default menu panel is nav_menu
.