You can also use this in wordpress conditional tags
Refer: https://codex.wordpress.org/Conditional_Tags
// Remove - Canonical for - [Search - Page] function remove_canonical() { // Disable for 'search' page if ( is_search() ) { add_filter( 'wpseo_canonical', '__return_false', 10, 1 ); } } add_action('wp', 'remove_canonical');
Remove canonical for ALL pages.
// Disable Canonical for - ALL pages function remove_canonical() { add_filter( 'wpseo_canonical', '__return_false', 10, 1 ); } add_action('wp', 'remove_canonical');
maheshwaghmare
source share