has_meta( int $postid )

Returns meta data for the given post ID.


Parameters

$postid

(Required) A post ID.


Return

(array[]) Array of meta data arrays for the given post ID.<br>

  • '...$0'
    (array) Associative array of meta data.<br>
    • 'meta_key'
      (string) Meta key.<br>
    • 'meta_value'
      (mixed) Meta value.<br>
    • 'meta_id'
      (string) Meta ID as a numeric string.<br>
    • 'post_id'
      (string) Post ID as a numeric string.<br>


Source

File: wp-admin/includes/post.php

function has_meta( $postid ) {
	global $wpdb;

	return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id
			FROM $wpdb->postmeta WHERE post_id = %d
			ORDER BY meta_key,meta_id", $postid), ARRAY_A );
}


Changelog

Changelog
Version Description
1.2.0 Introduced.