WordPress at a glance

get_post_meta() WP 1.0

Retrieve post meta field for a post.

Works based on: get_metadata()
✈ 1 time = 0.00013s = fast | 50000 times = 1.0s = very fast

No Hooks.

Return

Mixed. Will be an array if $single is false. Will be value of meta data field if $single is true.

Usage

get_post_meta( $post_id, $key, $single );
$post_id(int) (required)
Post ID.
$key(string)
The meta key to retrieve. By default, returns data for all keys.
Default: ''
$single(true/false)
Whether to return a single value.
Default: false

Code of get_post_meta: wp-includes/post.php VER 4.9.8

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

Related Functions

From tag: Metadatas (any)

No comments
    Hello, !     Log In . Register