has_meta

Get meta data for the given post ID.

Description

has_meta( (int) $postid ); 

Parameters (1)

0. $postid (int)
The postid.

Usage

  1. if ( !function_exists( 'has_meta' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/post.php'; 
  3.  
  4. // The postid. 
  5. $postid = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = has_meta($postid); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/post.php  
  1. function has_meta( $postid ) { 
  2. global $wpdb; 
  3.  
  4. return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id 
  5. FROM $wpdb->postmeta WHERE post_id = %d 
  6. ORDER BY meta_key, meta_id", $postid), ARRAY_A );