From 8ac3015ccfb40be5a213c8c46b0fad86e159845d Mon Sep 17 00:00:00 2001 From: duck_ Date: Tue, 21 Feb 2012 20:20:50 +0000 Subject: [PATCH] Stop invalid SQL syntax by bailing from wp_get_object_terms() if $object_ids or $taxonomies is empty. Props batmoo. Fixes #19952. git-svn-id: http://svn.automattic.com/wordpress/trunk@19975 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index dc64bcb5e..d578b9759 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -1862,11 +1862,14 @@ function wp_delete_category( $cat_ID ) { * @param int|array $object_ids The ID(s) of the object(s) to retrieve. * @param string|array $taxonomies The taxonomies to retrieve terms from. * @param array|string $args Change what is returned - * @return array|WP_Error The requested term data or empty array if no terms found. WP_Error if $taxonomy does not exist. + * @return array|WP_Error The requested term data or empty array if no terms found. WP_Error if any of the $taxonomies don't exist. */ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) { global $wpdb; + if ( empty( $object_ids ) || empty( $taxonomies ) ) + return array(); + if ( !is_array($taxonomies) ) $taxonomies = array($taxonomies);