Uses
| Uses | Description |
|---|---|
| wp-includes/wp-db.php: wpdb::get_results() | Retrieves an entire SQL result set from the database (i.e., many rows). |
| wp-includes/wp-db.php: wpdb::prepare() | Prepares a SQL query for safe execution. |
Get meta data for the given post ID.
(int) (Required)
(mixed)
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
);
} | Version | Description |
|---|---|
| 1.2.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/has_meta