On this page
has_meta( int $postid ): array[]
Returns meta data for the given post ID.
Parameters
$postidint Required-
A post ID.
Return
array[] Array of meta data arrays for the given post ID.
...$0arrayAssociative array of meta data.meta_keystringMeta key.meta_valuemixedMeta value.meta_idstringMeta ID as a numeric string.post_idstringPost ID as a numeric string.
Source
File:
wp-admin/includes/post.php. View all referencesfunction 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 ); }Related
Uses
Uses Description wpdb::get_results() wp-includes/class-wpdb.php Retrieves an entire SQL result set from the database (i.e., many rows).
wpdb::prepare() wp-includes/class-wpdb.php Prepares a SQL query for safe execution.
Used By
Used By Description post_custom_meta_box() wp-admin/includes/meta-boxes.php Displays custom fields form fields.
wp_xmlrpc_server::get_custom_fields() wp-includes/class-wp-xmlrpc-server.php Retrieve custom fields for post.
Changelog
Version Description 1.2.0 Introduced.
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/has_meta