Correct inline docs and parameter names for get_objects_in_term() to reflect that it uses term ids, not term slugs. fixes #11835

git-svn-id: https://develop.svn.wordpress.org/trunk@13821 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2010-03-26 14:00:17 +00:00
parent a258c8ec2b
commit 84ba6e473e
1 changed files with 15 additions and 15 deletions

View File

@ -351,17 +351,17 @@ function register_taxonomy_for_object_type( $taxonomy, $object_type) {
* @uses $wpdb
* @uses wp_parse_args() Creates an array from string $args.
*
* @param string|array $terms String of term or array of string values of terms that will be used
* @param int|array $term_ids Term id or array of term ids of terms that will be used
* @param string|array $taxonomies String of taxonomy name or Array of string values of taxonomy names
* @param array|string $args Change the order of the object_ids, either ASC or DESC
* @return WP_Error|array If the taxonomy does not exist, then WP_Error will be returned. On success
* the array can be empty meaning that there are no $object_ids found or it will return the $object_ids found.
*/
function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
function get_objects_in_term( $term_ids, $taxonomies, $args = array() ) {
global $wpdb;
if ( !is_array( $terms) )
$terms = array($terms);
if ( ! is_array( $term_ids ) )
$term_ids = array( $term_ids );
if ( ! is_array( $taxonomies ) )
$taxonomies = array( $taxonomies );
@ -377,12 +377,12 @@ function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
$order = ( 'desc' == strtolower( $order ) ) ? 'DESC' : 'ASC';
$terms = array_map('intval', $terms);
$term_ids = array_map('intval', $term_ids );
$taxonomies = "'" . implode( "', '", $taxonomies ) . "'";
$terms = "'" . implode("', '", $terms) . "'";
$term_ids = "'" . implode( "', '", $term_ids ) . "'";
$object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($terms) ORDER BY tr.object_id $order");
$object_ids = $wpdb->get_col("SELECT tr.object_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tt.term_id IN ($term_ids) ORDER BY tr.object_id $order");
if ( ! $object_ids )
return array();