-
hello this is in reference with ticket https://support.rankmath.com/ticket/relcanonical-producing-twice/
/**
* 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
if(is_amp_endpoint()){
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 https://prnt.sc/sx1fl6
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The ticket ‘rel=”canonical” producing Twice’ is closed to new replies.