Definition:
function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {}
Add meta data field to a post.
Post meta data is called "Custom Fields" on the Administration Screen.
Parameters
- int $post_id: Post ID.
- string $meta_key: Metadata name.
- mixed $meta_value: Metadata value.
- bool $unique: Optional, default is false. Whether the same key should not be added.
Return values
returns:False for failure. True for success.
Source code
function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) { // make sure meta is added to the post, not a revision if ( $the_post = wp_is_post_revision($post_id) ) $post_id = $the_post; return add_metadata('post', $post_id, $meta_key, $meta_value, $unique); }
283
No comments yet... Be the first to leave a reply!