get_post_custom

Definition:
function get_post_custom( $post_id = 0 ) {}

Retrieve post meta fields, based on post ID.
The post meta fields are retrieved from the cache, so the function is optimized to be called more than once. It also applies to the functions, that use this function.

Parameters

  • int $post_id: post ID

Source code

function get_post_custom( $post_id = 0 ) {

	$post_id = absint( $post_id );



	if ( ! $post_id )

		$post_id = get_the_ID();



	if ( ! wp_cache_get( $post_id, 'post_meta' ) )

		update_postmeta_cache( $post_id );



	return wp_cache_get( $post_id, 'post_meta' );

}

1585

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: