How to set menu Display location

You can retrieve nav menu locations with get_nav_menu_locations int[] Associative array of registered navigation menu IDs keyed by their location name. If none are registered, an empty array. https://developer.wordpress.org/reference/functions/get_nav_menu_locations/ This refers to a theme mod internally named nav_menu_locations which can be used to update the locations. You can modify that returned value and then save … Read more

Get Menu Items from REST API (React)

getMenu() fetches data from the GET /wp/v2/menus/<id> endpoint, whereas getMenuItem() fetches data from the GET /wp/v2/menu-items/<id> endpoint, but they have the same usage syntax, where you just need to pass the ID of a menu or menu item. As for getMenuItems() and another function you can use — getMenus(), the endpoints are GET /wp/v2/menu-items (for … Read more

Problems with draft website pages

Possibly yes, possibly no. I would recommend setting them to private and published so that you can see links working. Drafts cannot be selected as menu links, nor do they have permalinks until they’re published (only the shortlinks and only while logged in), so that is why they aren’t working. If you’re afraid of taking … Read more

Any way to use classic Menus in Full Site Editing?

Is there any way to enable the Appearance->Menus in the admin dashboard while FSE theme is enabled I noticed that in some FSE themes the classic Menus admin page shows up under Appearance: when they include a register_nav_menus( … ) call within the after_setup_theme hook to define the relevant classic menu locations. See for example … Read more

Add A Menu Item To A WP_Nav_Menu Navigation via PHP Function

You can use wp_update_nav_menu_item() to programmatically add a new menu item to the database. Since this change persists, you shouldn’t execute this functionality on every page – it’s best used as a one-off (though in that case it might be easier and more efficient to use WP CLI as suggested by WebElaine in the comments), … Read more

Adding padding above menu

This forum is specific to WordPress internal workaround and your question is regarding element styling which does not belong here. Please try to use specific sites according to your question. For your problem, add the following lines in your theme’s stylesheet and it should be fixed. #masthead #cms-header.header-ontop { padding-top:15px; } #masthead #cms-header.header-sticky { padding-top:0; … Read more

Custom div to to menu wordpress afte

As toscho mentioned this can be done with the items_wrap argument. It would be something like this: ‘items_wrap’ => ‘<ul id=”%1$s”>%3$s</ul><div id=”MYDIV”></div>’ For more info see here.