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



get_post_meta ›

Depuis1.5.0
Dépréciéen/a
get_post_meta ( $post_id, $key = '', $single = false )
Paramètres: (3)
  • (int) $post_id Post ID.
    Requis: Oui
  • (string) $key Optional. The meta key to retrieve. By default, returns data for all keys. Default empty.
    Requis: Non
    Défaut: (vide)
  • (bool) $single Optional. If true, returns only the first value for the specified meta key. This parameter has no effect if $key is not specified. Default false.
    Requis: Non
    Défaut: false
Retourne:
  • (mixed) Will be an array if $single is false. Will be value of the meta field if $single is true.
Défini(e) dans:
Codex:

Retrieves a post meta field for the given post ID.



Source

function get_post_meta( $post_id, $key = '', $single = false ) {
	return get_metadata( 'post', $post_id, $key, $single );
}