Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created April 7, 2014 16:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/10023822 to your computer and use it in GitHub Desktop.
Save billerickson/10023822 to your computer and use it in GitHub Desktop.
<?php
/**
* Limit Primary Menu to Top Level Items
*
* @author Bill Erickson
* @link http://www.billerickson.net/customizing-menu-arguments/
*
* @param array @args
* @return array
*
*/
function be_primary_menu_args( $args ) {
if( 'primary' == $args['theme_location'] ) {
$args['depth'] = 1;
}
return $args;
}
add_filter( 'wp_nav_menu_args', 'be_primary_menu_args' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment