I register my main menu in my wordpress theme, but when i save and i try to see in my admin panel, does not appear.
The code:
function games_register_my_menus(){
register_nav_menus(
array(
'main-menu' => __( 'Header Menu' )
)
);
}
add_action( 'init', 'games_register_my_menus' );
Your action is too soon. You need to wait until the menu is set up.
Change
add_action( 'init', 'games_register_my_menus' );
to
add_action( 'after_setup_theme', 'games_register_my_menus' );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.