Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
Purpose
This filter can be used to filter the canonical URL.
Arguments (1)
- $url (string) – The canonical URL.
Example code snippet
The code snippet below is just an example of how this filter can be used. In the example below, AIOSEO is prevented from outputting a canonical URL for posts.
add_filter( 'aioseo_canonical_url', 'aioseo_filter_canonical_url' );
function aioseo_filter_canonical_url( $url ) {
if ( is_singular() ) {
return '';
}
return $url;
}