get_post_custom() – Retrieve post meta fields, based on post ID.

You appear to be a bot. Output may be restricted

Description

Retrieve post meta fields, based on post ID.

The post meta fields are retrieved from the cache where possible, so the function is optimized to be called more than once.

Usage

$mixed = get_post_custom( $post_id );

Parameters

$post_id
( int ) optional – Optional. Post ID. Default is the ID of the global `$post`.

Returns

mixed An array of values. False for an invalid $post_id (non-numeric, zero, or negative value). An empty string if a valid but non-existing post ID is passed.

Source

File name: wordpress/wp-includes/post.php
Lines:

1 to 8 of 8
function get_post_custom( $post_id = 0 ) {
  $post_id = absint( $post_id );
  if ( ! $post_id ) {
    $post_id = get_the_ID();
  }

  return get_post_meta( $post_id );
}
 

 View on GitHub View on Trac