rel=”canonical” producing Twice

  • hello this is in reference with ticket

    * Allow changing of the canonical URL.
    * @param string $canonical The canonical URL.
    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    // Create suitable conditional for your amp plugin, this is an example
    return false;
    return $canonical;

    the given code is laced in theme functions.php but retured an error as

    Your PHP code changes were rolled back due to an error on line 53 of file wp-content/themes/generatepress_child/functions.php. Please fix and try saving again.
    Uncaught Error: Call to undefined function is_amp_endpoint() in wp-content/themes/generatepress_child/functions.php:53
    Stack trace:
    #0 wp-includes/class-wp-hook.php(287): {closure}('https://petyaar...')
    #1 wp-includes/plugin.php(206): WP_Hook->apply_filters('https://petyaar...', Array)
    #2 wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-paper.php(389): apply_filters('rank_math/front...', 'https://petyaar...')
    #3 wp-content/plugins/seo-by-rank-math/includes/frontend/paper/class-paper.php(340): RankMath\Paper\Paper->generate_canonical()
    #4 wp-content/plugins/seo-by-rank-math/includes/frontend/class-head.php(209): RankMath\Paper\Paper->get_canonical()
    #5 wp-includes/class-wp-hook.php(287): RankMath\Frontend\Head->canonical()
    #6 wp-includes/class-wp-hook.php(311): WP_Hook->apply_filte

    attaching screenshot

Viewing 1 replies (of 1 total)
  • Hello,

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

    ​​​​We might need to take a closer look at the settings. 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:

    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):

    We really look forward to helping you.


    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 1 replies (of 1 total)

The ticket ‘rel=”canonical” producing Twice’ is closed to new replies.