Title: add_{$meta_type}_metadata
Published: April 25, 2014
Last modified: May 20, 2026

---

# apply_filters( “add_{$meta_type}_metadata”, null|int|false $check, int $object_id, string $meta_key, mixed $meta_value, bool $unique )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#wp--skip-link--target)

Short-circuits adding metadata of a specific type.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#description)󠁿

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`

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#parameters)󠁿

 `$check`null|int|false

Whether to allow adding metadata for the given type. Return false or a meta ID to
short-circuit the function. Return null to continue with the default behavior.

`$object_id`int

ID of the object metadata is for.

`$meta_key`string

Metadata key.

`$meta_value`mixed

Metadata value. Must be serializable if non-scalar.

`$unique`bool

Whether the specified meta key should be unique for the object.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#source)󠁿

    ```php
    $check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/meta.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/meta.php#L90)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/meta.php#L90-L90)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#related)󠁿

| Used by | Description | 
| [add_metadata()](https://developer.wordpress.org/reference/functions/add_metadata/)`wp-includes/meta.php` |

Adds metadata for the specified object.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/add_meta_type_metadata/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fadd_meta_type_metadata%2F)
before being able to contribute a note or feedback.