Support » Plugin: Multisite Language Switcher » Translated category id differs from original, ‘child_of’ will not work as filter

  • Resolved notknow


    Hi everyone.

    Might be simple but then… i am using categories for to filter exhibitions on a yearly base, ie one category is 2018, one is 2019 etc. in a multisite install where i have two languages going (de & en using multisite for this).

    When i translate a category with Multi Site Language Switcher a new category gets created within the other site/language and this newly created category has a different id than the original category.

    I checked the always available category ‘General’ which comes from the core system and, checking the database, found that they both have the category id of ‘1’, for english (‘General’) and for german (‘Allgemein’). So ‘child_of’ in the function ‘wp_list_categories’ will work in both languages when set to ‘1’ and display all sub categories.

    But it will not work set to any id in the original language that belongs to a year because the translated category, even if it has the same name, has a different id and the translated page will show zero results because ‘child-of’ points to the wrong id (the id of the oringinal category of the translated category).

    How can one get around this? Messing with the db is no option. Has to be dynamic. Maybe it’s just late. Thanks for any input.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Simplest ‘for-now’ solution is to put a switch into the template:

    if (get_locale() == ‘en_GB’) {…}
    else if (get_locale() == ‘de_DE’) {…}

    and define two slightly different ‘wp_list_categories’-functions with different id’s as values for ‘child-of’ within. New years would get added automatically.

    Now i am curious: could this behaviour be changed within MSLS easily? S’pose not. Where did the enforcement take place to have ‘General’ have the id of ‘1’ both within the original and the translation?

    Plugin Author Dennis Ploetner


    Are those categories tied together … using the functionality in the admin dashboard? If so, there should be no problem to get the stored connection.

    What do you get if you pass the locale to the API function get_msls_permalink?

    Read on also here:

    Hi Dennis, thanks for your reply.

    My version with the ‘get_locale’ switch within the template works.
    I was just wondering if there is a way to let categories in the second site (english) have the same category ids as those on the first site (german).

    Then i would not have to have this ‘locale’-switch there, i.e. if i filtered on ‘child-of’ => 8 i would have all child categories no matter which language is currently used in the frontend.

    If i were to filter for children of category ‘General (Allgemein)’ i would not have to use this ‘globale’-switch as ‘General’-category has the id 1 (second site) AND the ‘Allgemein’-category also has an id of ‘1’ (first site). All other categories do not have the same category-id for original and translation.

    Plugin Author Dennis Ploetner


    Ok, I see. Your problem is probably that you cannot guarantee (even if you would be able to align the existing content) equal ids for future content. I guess, that this is a bit out of the scope of the plugin.

    Is this for performance issues?

    Hi Dennis.

    To be honest, it’s out of the strong relationship between me and Typo3 (since more than 10 years, not an extreme expert as i also do other stuff but i know my way around there). It’s practical to know every entity always keeps its id be it translated into one – or into more – languages. Makes filtering easy etc. And as you say it might bring a performance boost if i had to check on this quite often in the sources.

    Thanks again for your kind support and for ‘thinking along’ with my question, a rare thing 🙂

    Btw, the more i use your extension the more i like it. Translating categories and such also works nicely. I like the concept. I am on a low budget here but i will try and persuade my client to make a donation for it.

    • This reply was modified 1 year, 10 months ago by notknow.
    Plugin Author Dennis Ploetner


    Thanks a lot!


Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Translated category id differs from original, ‘child_of’ will not work as filter’ is closed to new replies.