Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/add meta


Adds metadata for a particular post. The information used is POSTed from the "Custom Fields" form on the Edit Post Administration screen.


 <?php add_meta$post_ID ); ?> 


(integer) (required) The post ID to associate the metadata with.
Default: None

Return Values

FALSE for failure. TRUE for success.


Unless you developed a custom post form that uses the custom field widget,
there is little reason to use this function 
add_meta( $post_ID );


Data used for the added metadata is taken from $_POST['metakeyselect'], $_POST['metakeyinput'], $_POST['metavalue']. Either the select or input fields are used for the meta key. If both are present, input field is used.

Change Log

Since: 1.2.0

Source File

add_meta() is located in wp-admin/includes/post.php.


add_meta_box(), add_metadata(), add_post_meta(), add_user_meta()

See also index of Function Reference and index of Template Tags.
This page is marked as incomplete. You can help Codex by expanding it.