register_meta ( $object_type, $meta_key, $args, $deprecated = null )

  • (string) $object_type Type of object this meta is registered to.
  • (string) $meta_key Meta key to register.
  • (array) $args { Data used to describe the meta key when registered.
  • (string|array) $deprecated Deprecated. Use `$args` instead.
  • (bool) True if the meta key was successfully registered in the global array, false if not. Registering a meta key with distinct sanitize and auth callbacks will fire those callbacks, but will not add to the global registry.
Defined at:
Change Log:
  • 4: .
  • 4: .
  • 5: .


Registers a meta key.

It is recommended to register meta keys for a specific combination of object type and object subtype. If passing an object subtype is omitted, the meta key will be registered for the entire object type, however it can be partly overridden in case a more specific meta key of the same name exists for the same object type and a subtype.

If an object type does not support any subtypes, such as users or comments, you should commonly call this function without passing a subtype.

Related Functions

register_post_meta, register_term_meta, unregister_meta_key, unregister_term_meta, register_widget

Top Google Results

User discussions

wpseek mobile