From 85b5a63f56b975a852900f13764561ad9e4d6c7b Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Sun, 28 Mar 2010 04:19:44 +0000 Subject: [PATCH] Fix notices in post_custom(). Props sirzooro. Fixes #11839 git-svn-id: https://develop.svn.wordpress.org/trunk@13861 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post-template.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 6e8ba5efe5..0a93023add 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -655,12 +655,14 @@ function wp_link_pages($args = '') { * @since 1.5.0 * * @param string $key Meta data key name. - * @return string|array Array of values or single value, if only one element exists. + * @return bool|string|array Array of values or single value, if only one element exists. False will be returned if key does not exist. */ function post_custom( $key = '' ) { $custom = get_post_custom(); - if ( 1 == count($custom[$key]) ) + if ( !isset( $custom[$key] ) ) + return false; + elseif ( 1 == count($custom[$key]) ) return $custom[$key][0]; else return $custom[$key];