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_postnav_menu_items_page
Hook dynamiczny — możliwe nazwy
nav_menu_items_pagenav_menu_items_postParametry
| Parametr | Typ | Opis |
|---|---|---|
$posts | object[] | 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. |
$args | array | An array of <code>WP_Query</code> arguments. |
$post_type | \WP_Post_Type | The 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
}
// 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