• Resolved Ohidul Islam

    (@wahid0003)


    Hi TranslatePress team,

    Do you have any references for hooks?

    I need to switch the site language by a filter hook. Can you please give me the filter hook with an example?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • i would like to know this as well

    Plugin Support Alex

    (@alexcozmoslabs)

    Hi,

    If you want to change from a language to another, through PHP, you need just to redirect to that language:

    $trp = TRP_Translate_Press::get_trp_instance();
    $url_converter = $trp->get_component( 'url_converter' );
    $code = "en_US";
    $current_url_in_english = esc_url( $url_converter->get_url_for_language($code, false, '') );
    wp_redirect( $current_url_in_english );
    exit;

    thank you alex. looks interesting

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hooks Reference’ is closed to new replies.