Headless Issue of the URLS

#939194
Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    Please note that Rank Math only generates the URLs that are configured within the WordPress settings (see screenshot below) and since the generation of the website’s content including the meta tags is server-side, there’s no way our plugin will be able to account for the true domain name unless you indicate it in the WordPress settings.

    Rank Math support

    If changing the above settings can’t be done from your end, then you’ll have to make use of our filters to change each element Rank Math is generating via the headless API.

    For starters, here’s an example code to fix the URLs for the Canonical URL:

    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    	$canonical = str_replace("www.cms.androidhire.com", "www.androidhire.com", $canonical);
    
    	return $canonical;
    });

    You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Here’s a full guide for our available filter codes: https://rankmath.com/kb/filters-hooks-api-developer/

    Hope that helps.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.