On which hook should I be calling register_nav_menu(s)?

First off, you should not register functions loose in functions.php because you cannot remove them (using remove_action). It can also cause debug errors since WP may not yet be stable. By using a hook you are making sure WP is stable enough to run your code, and what you need to use has been loaded.

Check out the answer on the WordPress Forums for more info


To decide which hook to use, first check out this answer.

The main difference between the two:

  • The user is not authenticated at after_setup_theme
  • The user becomes authenticated at init.

The after_setup_theme hook is therefore obviously run before init, you can see this in the Action Reference

According to the WordPress Codex page on after_setup_theme:

This hook is called during each page load, after the theme is
initialized. It is generally used to perform basic setup,
registration, and init actions for a theme.


Since you are registering menus, I would suggest using after_setup_theme. The WordPress Codex for register_nav_menu() also uses the after_setup_theme hook in one of the examples.

Leave a Comment