get_canonical_url filter-hook . WP 4.6.0
Filters the canonical URL for a post.
Usage
add_filter( 'get_canonical_url', 'filter_function_name_8893', 10, 2 ); function filter_function_name_8893( $canonical_url, $post ){ // filter... return $canonical_url; }
- $canonical_url(string)
- The post's canonical URL.
- $post(WP_Post)
- Post object.
Changelog
Since 4.6.0 | Introduced. |
Where the hook is called
get_canonical_url
wp-includes/link-template.php 3835
return apply_filters( 'get_canonical_url', $canonical_url, $post );