From 8abdcecbfe29bfe3390b6efb8aa91d13d81da2fb Mon Sep 17 00:00:00 2001 From: dd32 Date: Sun, 28 Mar 2010 04:19:44 +0000 Subject: [PATCH] Fix notices in post_custom(). Props sirzooro. Fixes #11839 git-svn-id: http://svn.automattic.com/wordpress/trunk@13861 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 6e8ba5efe..0a93023ad 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];