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
214
215           if ( $menu_exists )
216                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'] ) ) );
217
218           $_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args );
219
220           if ( is_wp_error( $_menu ) )
221                return $_menu;
222
223           do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data );
224
225           return (int) $_menu['term_id'];
226      }
227
228      if ( ! $_menu || ! isset( $_menu->term_id ) )
229           return 0;
230
231      $menu_id = (int) $_menu->term_id;
232