Skip to content Skip to sidebar

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.

Author Posts
March 11, 2026 at 7:44 am #17887619

pietR-2

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]);

March 11, 2026 at 7:50 am #17887744

pietR-2

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.