Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created June 11, 2015 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/b61c1cf65103daf7cdca to your computer and use it in GitHub Desktop.
Save tripflex/b61c1cf65103daf7cdca to your computer and use it in GitHub Desktop.
WordPress wp_get_object_terms convert $taxonomies SQL-formatted (comma-separated and quoted) to array
// Because get_object_terms filter was not included until WP 4.2+ we have to use wp_get_object_terms for backwards compatibility.
// Unfortunately this means taxonomies are passed like this: ( 'resume_category', 'resume_skill' ), so we have to remove the quotes,
// and then use explode to convert it into an array of taxonomies.
$tax_array = explode( ", ", str_replace( "'", "", $taxonomies ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment