X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/72836ec95a52eacbda4dc5aa296b7dd6de08bd3b..888fa4ed68091f3314f711c5f6fe75858bf5410b:/wp-admin/includes/nav-menu.php?ds=sidebyside diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index d3aa7bd0..05a9b294 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -231,7 +231,6 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { /** * Create HTML list of nav menu input items. * - * @package WordPress * @since 3.0.0 * @uses Walker_Nav_Menu */ @@ -503,6 +502,16 @@ function wp_nav_menu_post_type_meta_boxes() { return; foreach ( $post_types as $post_type ) { + /** + * Filter whether a menu items meta box will be added for the current post type. + * + * If a falsey value is returned instead of a post type object, + * the post type menu items meta box will not be added. + * + * @since 3.0.0 + * + * @param object $post_type The post type object to be used as a meta box. + */ $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type ); if ( $post_type ) { $id = $post_type->name; @@ -525,6 +534,16 @@ function wp_nav_menu_taxonomy_meta_boxes() { return; foreach ( $taxonomies as $tax ) { + /** + * Filter whether a menu items meta box will be added for the current taxonomy. + * + * If a falsey value is returned instead of a taxonomy object, + * the taxonomy menu items meta box will not be added. + * + * @since 3.0.0 + * + * @param object $tax The taxonomy object to be used as a meta box. + */ $tax = apply_filters( 'nav_menu_meta_box_object', $tax ); if ( $tax ) { $id = $tax->name; @@ -780,7 +799,22 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { } } - $posts = apply_filters( 'nav_menu_items_'.$post_type_name, $posts, $args, $post_type ); + /** + * Filter the posts displayed in the 'View All' tab of the current + * post type's menu items meta box. + * + * The dynamic portion of the hook name, $post_type_name, + * refers to the slug of the current post type. + * + * @since 3.2.0 + * + * @see WP_Query::query() + * + * @param array $posts The posts for the current post type. + * @param array $args An array of WP_Query arguments. + * @param object $post_type The current post type object for this menu item meta box. + */ + $posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type ); $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args ); if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) { @@ -812,7 +846,7 @@ function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) { - class="button-secondary submit-add-to-menu right" value="" name="add-post-type-menu-item" id="" /> + class="button-secondary submit-add-to-menu right" value="" name="add-post-type-menu-item" id="" />

@@ -1000,7 +1034,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) { - class="button-secondary submit-add-to-menu right" value="" name="add-taxonomy-menu-item" id="" /> + class="button-secondary submit-add-to-menu right" value="" name="add-taxonomy-menu-item" id="" />

@@ -1137,6 +1171,14 @@ function wp_get_nav_menu_to_edit( $menu_id = 0 ) { if( empty($menu_items) ) return $result . ' '; + /** + * Filter the Walker class used to render a menu formatted for editing. + * + * @since 3.0.0 + * + * @param string $walker_class_name The Walker class used to render a menu formatted for editing. + * @param int $menu_id The ID of the menu being rendered. + */ $walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id ); if ( class_exists( $walker_class_name ) ) @@ -1281,6 +1323,7 @@ function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_select wp_defer_term_counting( false ); + /** This action is documented in wp-includes/nav-menu.php */ do_action( 'wp_update_nav_menu', $nav_menu_selected_id ); $messages[] = '

' . sprintf( __( '%1$s has been updated.' ), $nav_menu_selected_title ) . '

';