Does RankMath Free support polylang?

#962797
  • Resolved Elvinas SS
    Rank Math free

    Hello, I am using Fre version although I a am not sure if I am able to submit a ticket here, because I only using RankMath FREE, and I found an article that provides support for Polylang here: https://rankmath.com/kb/polylang-compatibility/

    I have tried this fix, and I am not sure if RankMath is supposed to fix that problem, but I have ‘English’ language in polylang as my secondary language so url looks liket this: website.com/en, and canonical tag still points to website.com/ without ‘en’. I wonder is that fix supposed to fix this or only Rankmath Pro supports that.

    Thank you so much in advance

    Best regards

    Elvinas

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    We apologize for the issue you are facing with Polylang and Rank Math. The compatibility fix you found in the article is intended to help users who are using Polylang with Rank Math, including those on the free version. However, since Polylang does not have native compatibility with Rank Math, there may still be some limitations or issues that arise.

    The fix you implemented should ideally help with canonical tags and other related issues, but if the canonical tag is still pointing to website.com/ instead of website.com/en, it may require further adjustments or troubleshooting.

    For more detailed assistance, we recommend replying to your ticket, and a human agent from the Rank Math Support team will take over and provide you with the necessary help. Thank you for raising this concern!

    Sources:
    How to Make Polylang Compatible With Rank Math

    Also I am a bit proficient in PHP, so I in that article where it adds Polylang support I would like to add, that I was able to solve the issue, in the rank-math-ppl.php file I modified one method:

        public function rm_home_canonical( $canonical ) {
            //if ( ! is_home() ) {
            //    return $canonical;
            //}
            
            if ( ! is_front_page() ) {
    			return $canonical;
    		}
    
            $path = ltrim( (string) wp_parse_url( pll_get_requested_url(), PHP_URL_PATH ), '/' );
            return $canonical . $path;
    
        }

    Notice that I commented out is_home() call check, and added is_front_page, as in my case, is_front_page works correctly and front page returns true for: website.com/ and website.com/en/, but if is_home used I get false everywhere there, so now as is_front_page is identified the correct canonical url is being served.

    I’m really not sure about the differences about is_home and is_front_page I need to learn about it, but do you think this is feasible solution as of now?

    Just in case I provide the versions of my website:
    WordPress 6.7.1
    RankMath Free 1.0.237
    Polylang Free 3.6.6

    Although now I am glad with the modification I made and my main concern was that before this on secondary language ‘en’ on my website the canonical url was website.com/ when it should have been website.com/en/, as I added this suggested code but just change from is_home() to is_front_page() check although I am not sure if I won’t break canonical urls that way somewhere else. So I would like to know, will it only affect my front pages and nothing else.

    Thank you in advance

    Hello,

    Thanks for sharing your solution. If your homepage setup requires it, changing is_home() to is_front_page() makes sense. is_home() checks for the blog page, while is_front_page() checks the actual front page, which is likely why your modification works correctly for your multilingual setup. is_front_page() checks if the current page is the site’s main homepage, whether it’s a static page or latest posts.

    Your modification should only affect the front page canonical URLs and not impact other pages. However, we recommend thorough testing to ensure no unintended effects on other canonical tags.

    Let us know if you need further assistance.

    Thank you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Does RankMath Free support polylang?’ is closed to new replies.