Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 1 down vote accepted
<?php
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
add comment

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
add comment

Your Answer

 
discard

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.