WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to set the default "Automatically add new top-level pages" to be checked when creating a new menu. I haven't been able to find anything on this - any help you could give me? Thanks!

share|improve this question
up vote 3 down vote accepted
add_action( 'wp_create_nav_menu', 'PREFIX_nav_menu_auto_add_by_default' );
function PREFIX_nav_menu_auto_add_by_default( $id ) {
    $options = (array) get_option( 'nav_menu_options' );
    if ( ! isset( $options['auto_add'] ) ) {
        $options['auto_add'] = array();
    $options['auto_add'][] = $id;
    update_option( 'nav_menu_options', $options );
share|improve this answer
Just want to clarify draebb's answer '$id' is the menu id that we want the top level pages to be added to automatically. So if we want to get the menu $menu_obj = wp_get_nav_menu_object( $menu_name ); and then $menu_id = $menu_obj->term_id; // yes, the menu is a taxonomy. – Svetoslav Marinov Jun 7 at 15:42

When you create menu check there's a check box "Automatically add new top-level pages " just check it and save

share|improve this answer
Hi - this is more to have this option checked by default instead of having to check it off each time (for client work). Little miffed on where this is stored/if we can edit that. Thanks! – Zach Nov 29 '11 at 14:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.