Snippet to re-add page menu if no custom menu created
-
Version 14.10 introduced a change which causes the top menu to no longer list pages as the default menu if not custom menu exists. We didn’t want to upgrade this theme our multisite due to this because a lot of users do not create this menu.
The following filter in as a mu-plugin or equivalent will re-add the wp_page_menu function as the default fallback into this theme
add_filter( 'wp_nav_menu_args' , 'psu_addelle_nav_menu_args' ); function psu_addelle_nav_menu_args( $args ) { if ( $args['theme_location'] == 'top_menu' ) { $args['fallback_cb'] = 'wp_page_menu'; } return $args; }
- The topic ‘Snippet to re-add page menu if no custom menu created’ is closed to new replies.