i know there are plugins that’ll let us add custom or automatic Canonical links in the head of our pages. i was about to do something like that when i noticed my pages already have Canonical links in the head…
<meta name="generator" content="WordPress 5.7.2" />
<link rel="canonical" href="https://domain.com/page/" />
<link rel='shortlink' href='https://domain.com/?p=35' />
so i’m curious to know where this is coming from. does anyone know?
Hey SyberKnight,
Thank you for the inquiry.
It is automatically added by WordPress in the head tag using the wp_head hook and with the following function as the callback.
// https://developer.wordpress.org/reference/functions/rel_canonical/
If you want to remove it, just add this code in the functions.php file.
remove_action( 'wp_head', 'rel_canonical' );
Best regards,
Ismael