Make WordPress Core

Changeset 13861


Ignore:
Timestamp:
03/28/2010 04:19:44 AM (15 years ago)
Author:
dd32
Message:

Fix notices in post_custom(). Props sirzooro. Fixes #11839

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r13772 r13861  
    656656 *
    657657 * @param string $key Meta data key name.
    658  * @return string|array Array of values or single value, if only one element exists.
     658 * @return bool|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist.
    659659 */
    660660function post_custom( $key = '' ) {
    661661    $custom = get_post_custom();
    662662
    663     if ( 1 == count($custom[$key]) )
     663    if ( !isset( $custom[$key] ) )
     664        return false;
     665    elseif ( 1 == count($custom[$key]) )
    664666        return $custom[$key][0];
    665667    else
Note: See TracChangeset for help on using the changeset viewer.