Filters the canonical URL for a post.
Parameters
$canonical_urlstring- The post’s canonical URL.
$postWP_Post- Post object.
Source
return apply_filters( 'get_canonical_url', $canonical_url, $post );
Changelog
| Version | Description |
|---|---|
| 4.6.0 | Introduced. |
Filters the canonical URL for a post.
$canonical_urlstring$postWP_Postreturn apply_filters( 'get_canonical_url', $canonical_url, $post );
| Version | Description |
|---|---|
| 4.6.0 | Introduced. |
You must log in before being able to contribute a note or feedback.
An example of using this filter. In this I am setting the canonical url through ACF in a field called ‘canonical_url’.