filtrdynamicznyod 5.5.0
default_{$meta_type}_metadata
Args 5Plik wp-includes/meta.php
Opis — z kodu źródłowego
Filters the default metadata value for a specified meta key and object.
The dynamic portion of the hook name, $meta_type, refers to the meta object type (blog, post, comment, term, user, or any other type with an associated meta table).
Possible filter names include:
default_blog_metadatadefault_post_metadatadefault_comment_metadatadefault_term_metadatadefault_user_metadata
Parametry
| Parametr | Typ | Opis |
|---|---|---|
$value | mixed | The value to return, either a single metadata value or an array of values depending on the value of <code>$single</code>. |
$object_id | int | ID of the object metadata is for. |
$meta_key | string | Metadata key. |
$single | bool | Whether to return only the first value of the specified <code>$meta_key</code>. |
$meta_type | string | Type of object metadata is for. Accepts 'blog', 'post', 'comment', 'term', 'user', or any other object type with an associated meta table. |
Wywołanie
Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'default_{$meta_type}_metadata', 'twoja_funkcja', 10, 5 );
function twoja_funkcja($param_1, $param_2, $param_3, $param_4, $param_5) {
// Twój kod
}
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'default_{$meta_type}_metadata', 'twoja_funkcja', 10, 5 );
function twoja_funkcja($param_1, $param_2, $param_3, $param_4, $param_5) {
// Twój kod
}