Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_create_nav_menu

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
231
232           if ( $menu_exists )
233                return new WP_Error( 'menu_exists', sprintf( __('The menu name <strong>%s</strong> conflicts with another menu name. Please try another.'), esc_html( $menu_data['menu-name'] ) ) );
234
235           $_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args );
236
237           if ( is_wp_error( $_menu ) )
238                return $_menu;
239
240           do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data );
241
242           return (int) $_menu['term_id'];
243      }
244
245      if ( ! $_menu || ! isset( $_menu->term_id ) )
246           return 0;
247
248      $menu_id = (int) $_menu->term_id;
249