How to get header’s nav object programmatically?
-
Hello,
I am brand new to WordPress.
I just download 6.1.1 and try to learn wordpress. All settings are default by the installation. The scheme is TT3.
In the admin dashboard, I see a “Header navigation”, I can interactively create some menus without problem.
I try to get this navigation object programatically and see if I can add some menus into it in php. However, all methods return false or null using wp functions below.
$locations = get_nav_menu_locations();
var_dump( $locations );$nav = wp_get_nav_menu_object( “Header navigation” );
var_dump( $nav );$nav = wp_get_nav_menu_object( “” );
var_dump( $nav );$locations = get_theme_mod( ‘nav_menu_locations’ );
var_dump( $locations );What do I do wrong? Thank you for your help.
- The topic ‘How to get header’s nav object programmatically?’ is closed to new replies.