Home › Support › English Support › [Resolved] get_terms to get all category ids in all languages
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
This topic contains 1 replies, has 1 voice.
Last updated by pietR-2 1 month, 1 week ago.
I need to get all product categories in all languages based on an array with slugs ($categorySlugs). This code wil not do that, it will only get the ids for the current language.
$categoryIdsLanguage = get_terms([ 'taxonomy' => Taxonomy::PRODUCT_CATEGORY, 'slug' => $categorySlugs, 'fields' => 'ids', 'hide_empty' => false]);
That categorySlugs array has several unwanted category slugs in it: const UNCATEGORIZED = [ 'uncategorized', 'overige', 'ongecategoriseerd', 'niet-gecategoriseerd', 'nicht-kategorisiert', 'ubrige' ];
I just want to have there id's so i can store them in a cache and filter out products that are underneath those categories.