From 5fcb582c259d0f6062b3c57d5a8e4a08db73bb6b Mon Sep 17 00:00:00 2001 From: Jon Cave 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: https://develop.svn.wordpress.org/trunk@19975 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 dc64bcb5ea..d578b97597 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);