Support » Plugin: Translate Multilingual sites - TranslatePress » How can I check if user has selected language from language switcher ?

  • Resolved moinr

    (@moinr)


    Is there any way to check if user has selected his language from the language swithcher ?

    I would like to know the language in template_redirect hook.

    Please help me.

Viewing 1 replies (of 1 total)
  • Plugin Support Alex

    (@alexcozmoslabs)

    Using Javascript you can add a get parameter to the language switcher. Then, if a user clicks the language switcher, that parameter will be passed on and you can use it to know the user clicked it.
    Also, if you just need the current language, check out the global $TRP_LANGUAGE; variable in PHP.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.