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 comment