wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



has_meta › WordPress Function

Depuis1.2.0
Dépréciéen/a
has_meta ( $post_id )
Paramètres:
  • (int) $post_id A post ID.
    Requis: Oui
Retourne:
  • (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. } }
Défini(e) dans:
Codex:

Returns meta data for the given post ID.



Fonctions en relation: has_tag, has_term_meta, add_meta, the_meta, list_meta

Source

function 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
	);
}