Last active
August 19, 2019 14:42
-
-
Save jbrinley/9101f1e350c236e4e3c18568cf8dea8f to your computer and use it in GitHub Desktop.
Convert BigCommerce category IDs to WordPress category IDs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function bc_cats_to_wp_cats( $category_ids ) { | |
$query = new \WP_Term_Query(); | |
return $query->query( [ | |
'taxonomy' => \BigCommerce\Taxonomies\Product_Category\Product_Category::NAME, | |
'meta_query' => [ | |
[ | |
'key' => 'bigcommerce_id', | |
'value' => $category_ids, | |
'compare' => 'IN', | |
], | |
], | |
'hide_empty' => false, | |
'fields' => 'ids' | |
] ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment