post_custom() – Retrieve post custom meta data field.

You appear to be a bot. Output may be restricted

Description

Retrieve post custom meta data field.

Usage

$array|string|false = post_custom( $key );

Parameters

$key
( string ) optional – Meta data key name.

Returns

array|string|false Array of values, or single value if only one element exists. False if the key does not exist.

Source

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

1 to 11 of 11
function post_custom( $key = '' ) {
  $custom = get_post_custom();

  if ( ! isset( $custom[ $key ] ) ) {
    return false;
  } elseif ( 1 === count( $custom[ $key ] ) ) {
    return $custom[ $key ][0];
  } else {
    return $custom[ $key ];
  }
}
 

 View on GitHub View on Trac