nav_menu_items_page
Filters the posts displayed in the 'View All' tab of the current post type's menu items meta box.
Это один из вариантов динамического хука nav_menu_items_(post_type_name)
Использование
add_filter( 'nav_menu_items_page', 'wp_kama_nav_menu_items_page_filter', 10, 3 ); /** * Function for `nav_menu_items_page` filter-hook. * * @param object[] $posts The posts for the current post type. Mostly `WP_Post` objects, but can also contain "fake" post objects to represent other menu items. * @param array $args An array of `WP_Query` arguments. * @param WP_Post_Type $post_type The current post type object for this menu item meta box. * * @return object[] */ function wp_kama_nav_menu_items_page_filter( $posts, $args, $post_type ){ // filter... return $posts; }
- $posts(object[])
- The posts for the current post type. Mostly WP_Post objects, but can also contain "fake" post objects to represent other menu items.
- $args(массив)
- An array of WP_Query arguments.
- $post_type(WP_Post_Type)
- The current post type object for this menu item meta box.
Список изменений
С версии 3.2.0 | Введена. |
С версии 4.6.0 | Converted the $post_type parameter to accept a WP_Post_Type object. |
Где вызывается хук
nav_menu_items_page
wp-admin/includes/nav-menu.php 782-787
$posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type );