add_{$meta_type}_metadata

FILTER wp-includes\meta.php (ligne 90) github
Short-circuits adding metadata of a specific type. 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). Returning a non-null value will effectively short-circuit the function. Possible hook names include:  - `add_blog_metadata`  - `add_post_metadata`  - `add_comment_metadata`  - `add_term_metadata`  - `add_user_metadata`

Paramètres

Entrée :
null, $object_id, $meta_key, $meta_value, $unique
Sortie :
@param null|int|false $check      Whether to allow adding metadata for the given type. Return false or a meta ID
@param int            $object_id  ID of the object metadata is for.
@param string         $meta_key   Metadata key.
@param mixed          $meta_value Metadata value. Must be serializable if non-scalar.
@param bool           $unique     Whether the specified meta key should be unique for the object.

Utilisation

// Modifier la valeur avec le filtre 'add_{$meta_type}_metadata'
add_filter('add_{$meta_type}_metadata', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre(null) {
    // Modifier la valeur
    return null;
}

Actualités

Chargement des actualités...