79463878

Date: 2025-02-24 14:44:00
Score: 2
Natty:
Report link

I don't know much about "Polylang" plugin but upon searching "pll_get_post" might do it.

replace your code with this code and "1" with your thank you page post id.

add_action( 'wp_footer', 'mycustom_wp_footer' );
function mycustom_wp_footer() {
    if ( function_exists( 'pll_get_post' ) ) {
        // Get the translated Thank You page URL

        $page_id = 1; // Replace with the actual Thank You page ID in default language
        $new_thank_you_url = get_permalink( pll_get_post( $page_id ) );
    }
    ?>
    <script>
        document.addEventListener( 'wpcf7mailsent', function( event ) {
            location = "<?php echo esc_url( $translated_thank_you_url ); ?>";
        }, false );
    </script>
    <?php
}

Here is the link if you want to study about the function

https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/

Reasons:
  • Blacklisted phrase (0.5): thank you
  • Blacklisted phrase (0.5): Thank You
  • Blacklisted phrase (1): Here is the link
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Hamza Kingdom Vision