FB opengraph + WPML

#33309
  • Resolved FKWEB
    Rank Math pro

    Hi, my website main language is english.
    second language is french.
    I’m using Rank Math SEO to set up Facebook’s open graph parameters.

    WPML Language url format is set to add a parameter : ?lang=fr
    But for the property og:url, Rank Math seems to add an extra “/” after the language parameter:
    https://website.com/?lang=fr/

    thus the language is not recognized : Redirection HTTP 301 -> /?lang=fr%2F
    and so there is a redirection to main domain which is another language.

    Any idea how to get rid that extra “/” to make the whole thing works ?

    Thank you

    • This topic was modified 4 years, 10 months ago by FKWEB.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Could you please head over to your WP Dashboard > Settings > General and check whether the site address and WP address contain a trailing slash on the domain name and remove it?

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for contacting Rank Math today.

    Could you please add the following code snippet on your theme’s functions.php file and check if this will fix the problem:

    /**
     * Allow changing of the canonical URL.
     *
     * @param string $canonical The canonical URL.
     */
    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
            if(ICL_LANGUAGE_CODE =="fr"){
                return untrailingslashit($canonical);
            }
    	return $canonical;
    });

    If this does not work then we might need to take a closer look. ​​​​Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hi Michael,

    thank you for that code snippet, it worked just fine. The extra slash is now gone and so it shares the right language.

    thanks a lot for your precious help.

    Have a nice day.

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The ticket ‘FB opengraph + WPML’ is closed to new replies.