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
240
241           if ( $menu_exists )
242                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'] ) ) );
243
244           $_menu = wp_insert_term( $menu_data['menu-name'], 'nav_menu', $args );
245
246           if ( is_wp_error( $_menu ) )
247                return $_menu;
248
249           do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data );
250
251           return (int) $_menu['term_id'];
252      }
253
254      if ( ! $_menu || ! isset( $_menu->term_id ) )
255           return 0;
256
257      $menu_id = (int) $_menu->term_id;
258