Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 8 weeks ago

#31098 closed defect (bug) (duplicate)

Filter wp_get_object_terms sends the wrong $taxonomies value

Reported by: phoenixml's profile PhoenixML Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Taxonomy Keywords:
Focuses: Cc:


In the function wp_get_object_terms(), at the end, the value of $taxonomies (which should either be a slug string or an array of slugs) is overwritten and becomes a string from the sql query with single quotes before it is sent through the filter 'wp_get_object_terms'.

Example: " 'category,'post_tags' "
It should be: array('category', 'post_tags')

Change History (2)

#1 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed
  • Version changed from 4.1 to 2.8

Duplicate of #18828.

#2 @vizvizka
8 weeks ago

It seems like there might be an issue with the way the $taxonomies variable is handled within the wp_get_object_terms() function in WordPress. This function is responsible for retrieving the terms associated with an object (such as posts or custom post types).

add_filter('wp_get_object_terms', 'custom_get_object_terms', 10, 3);

function custom_get_object_terms($terms, $object_ids, $taxonomies) {

if (is_string($taxonomies)) {

$taxonomies = explode(',', $taxonomies);

$taxonomies = array_map('trim', $taxonomies);


return $terms;


Note: See TracTickets for help on using tickets.