Returns meta data for the given post ID.
$post_idintrequired
...$0 arraymeta_key stringmeta_value mixedmeta_id stringpost_id stringfunction has_meta( $post_id ) {
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",
$post_id
),
ARRAY_A
);
}
| Version | Description |
|---|---|
| 1.2.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/has_meta