WP HOOKS
filtrdynamicznyod 3.2.0

nav_menu_items_{$post_type_name}

Args 3Plik wp-admin/includes/nav-menu.php

Opis — z kodu źródłowego

Filters 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. Possible hook names include:

  • nav_menu_items_post
  • nav_menu_items_page

Hook dynamiczny — możliwe nazwy

nav_menu_items_pagenav_menu_items_post

Parametry

ParametrTypOpis
$postsobject[]The posts for the current post type. Mostly <code>WP_Post</code> objects, but can also contain "fake" post objects to represent other menu items.
$argsarrayAn array of <code>WP_Query</code> arguments.
$post_type\WP_Post_TypeThe current post type object for this menu item meta box.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'nav_menu_items_{$post_type_name}', 'twoja_funkcja', 10, 3 );

function twoja_funkcja($param_1, $param_2, $param_3) {
	// Twój kod
}

Popularne w tej kategorii