get_canonical_url WordPress Filter Hook
The get_canonical_url hook allows you to change the canonical URL of a post or page. This can be useful if you want to change the URL of a post or page to something different than what is set in the permalink settings.
apply_filters( 'get_canonical_url', string $canonical_url , WP_Post $post ) #
Filters the canonical URL for a post.
Parameters
- $canonical_url
(string)The post's canonical URL.
- $post
(WP_Post)Post object.
Source
Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |