has_meta

The timeline below displays how wordpress function has_meta has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.9

/**
 * Returns meta data for the given post ID.
 *
 * @since 1.2.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int $postid A post ID.
 * @return array[] {
 *     Array of meta data arrays for the given post ID.
 *
 *     @type array ...$0 {
 *         Associative array of meta data.
 *
 *         @type string $meta_key   Meta key.
 *         @type mixed  $meta_value Meta value.
 *         @type string $meta_id    Meta ID as a numeric string.
 *         @type string $post_id    Post ID as a numeric string.
 *     }
 * }
 */
function has_meta($postid)
{
    global $wpdb;
    return $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id\n\t\t\tFROM {$wpdb->postmeta} WHERE post_id = %d\n\t\t\tORDER BY meta_key,meta_id", $postid), ARRAY_A);
}

WordPress Version: 4.4

/**
 * Get meta data for the given post ID.
 *
 * @since 1.2.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int $postid
 * @return mixed
 */
function has_meta($postid)
{
    global $wpdb;
    return $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id\n\t\t\tFROM {$wpdb->postmeta} WHERE post_id = %d\n\t\t\tORDER BY meta_key,meta_id", $postid), ARRAY_A);
}

WordPress Version: 4.3

/**
 * Get meta data for the given post ID.
 *
 * @since 1.2.0
 *
 * @global wpdb $wpdb
 *
 * @param int $postid
 * @return mixed
 */
function has_meta($postid)
{
    global $wpdb;
    return $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id\n\t\t\tFROM {$wpdb->postmeta} WHERE post_id = %d\n\t\t\tORDER BY meta_key,meta_id", $postid), ARRAY_A);
}

WordPress Version: 4.2

/**
 * Get meta data for the given post ID.
 *
 * @since 1.2.0
 *
 * @param int $postid
 * @return mixed
 */
function has_meta($postid)
{
    global $wpdb;
    return $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id\n\t\t\tFROM {$wpdb->postmeta} WHERE post_id = %d\n\t\t\tORDER BY meta_key,meta_id", $postid), ARRAY_A);
}

WordPress Version: 4.1

/**
 * {@internal Missing Short Description}}
 *
 * Some postmeta stuff.
 *
 * @since 1.2.0
 *
 * @param int $postid
 * @return mixed
 */
function has_meta($postid)
{
    global $wpdb;
    return $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id\n\t\t\tFROM {$wpdb->postmeta} WHERE post_id = %d\n\t\t\tORDER BY meta_key,meta_id", $postid), ARRAY_A);
}

WordPress Version: 3.7

/**
 * {@internal Missing Short Description}}
 *
 * Some postmeta stuff.
 *
 * @since 1.2.0
 *
 * @param unknown_type $postid
 * @return unknown
 */
function has_meta($postid)
{
    global $wpdb;
    return $wpdb->get_results($wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id\n\t\t\tFROM {$wpdb->postmeta} WHERE post_id = %d\n\t\t\tORDER BY meta_key,meta_id", $postid), ARRAY_A);
}