“Automatically add new top-level pages” Default

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!

Related posts

Leave a Reply

2 comments

  1. <?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 );
    }