Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




add_post_meta [ WordPress Function ]

add_post_meta ( $post_id, $meta_key, $meta_value, $unique = false )
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.
Uses:
  • $wpdb
Links:
Returns:
  • (bool) False for failure. True for success.
Defined at:



Add meta data field to a post.

Post meta data is called "Custom Fields" on the Administration Screen.

Source


<?php
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);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics