Support » Plugin: Polylang » [Plugin: Polylang] Get_default_category

  • Resolved Compute



    I was wondering if there was a way to get the category of the default language?

    Lets say I have catA(id=5,default) and catB(id=9). Is there a way to get the id of catA when you have the value of catB?
    It should be possible, as the id of catA is stored in catB I just dont know how/where its getting saved 🙁

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chouby


    You can do that with the function pll_get_term.

    $tr_id = pll_get_term($cat_id, 'en');

    will return the id of the English translation of the category which has $cat_id as id. If the category is already in English, the function returns $cat_id.

    Wow. That was quick. Worked perfectly.

    I might be blind but have you written any manual for this plugin?

    Plugin Author Chouby


    In polylang/doc/documentation-en.pdf or even here.

    That is awesome. Thanks alot again 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Polylang] Get_default_category’ is closed to new replies.