Home / Admin / Remove the Canonical URL for a specific URL
Duplicate Snippet

Embed Snippet on Your Site

Remove the Canonical URL for a specific URL

This code snippet can be used to remove the canonical URL for a specific URL that contains '/properties/'

200+
Code Preview
php
<?php
add_filter( 'aioseo_canonical_url', 'aioseo_filter_canonical_url' );
function aioseo_filter_canonical_url( $url ) {
	if (strpos($url,'/properties/') !== false) {
		$url = home_url( $_SERVER['REQUEST_URI'] );
	}
	return $url;
}

Comments

Add a Comment