Switch language

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




delete_post_meta [ WordPress Function ]

delete_post_meta ( $post_id, $meta_key, $meta_value = '' )
Parameters:
  • (int) $post_id post ID
  • (string) $meta_key Metadata name.
  • (mixed) $meta_value Optional. Metadata value.
Uses:
  • $wpdb
Links:
Returns:
  • (bool) False for failure. True for success.
Defined at:



Remove metadata matching criteria from a post.

You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed.

Source


<?php
function delete_post_meta($post_id$meta_key$meta_value '') {
    
// 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 
delete_metadata('post'$post_id$meta_key$meta_value);
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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