filtrdynamicznyod 3.3.0
auth_{$object_type}_meta_{$meta_key}
Args 6Plik wp-includes/capabilities.php
Opis — z kodu źródłowego
Filters whether the user is allowed to edit a specific meta key of a specific object type.
Return true to have the mapped meta caps from edit_{$object_type} apply.
The dynamic portion of the hook name, $object_type refers to the object type being filtered. The dynamic portion of the hook name, $meta_key, refers to the meta key passed to map_meta_cap().
Parametry
| Parametr | Typ | Opis |
|---|---|---|
$allowed | bool | Whether the user can add the object meta. Default false. |
$meta_key | string | The meta key. |
$object_id | int | Object ID. |
$user_id | int | User ID. |
$cap | string | Capability name. |
$caps | string[] | Array of the user's capabilities. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'auth_{$object_type}_meta_{$meta_key}', 'twoja_funkcja', 10, 6 );
function twoja_funkcja($param_1, $param_2, $param_3, $param_4, $param_5, $param_6) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'auth_{$object_type}_meta_{$meta_key}', 'twoja_funkcja', 10, 6 );
function twoja_funkcja($param_1, $param_2, $param_3, $param_4, $param_5, $param_6) {
// Twój kod
}Popularne w tej kategorii