WP canonical URL compatibility
-
Hello,
Since WordPress 4.6, a new function has been added:
https://developer.www.ads-software.com/reference/functions/wp_get_canonical_url/There, you can filter the canonical URL.
An example:
add_filter( 'get_canonical_url', function( $canonical_url, $post ) { if ( is_wpforo_page() && is_wpforo_url( $canonical_url ) ); return wpforo_get_request_uri(); return $canonical_url; }, 10, 2 );
That’s all there’s to it ?? Be careful that the canonical URL function can be used to get other page’s URLs, aside from the current query.
Cheers!
- The topic ‘WP canonical URL compatibility’ is closed to new replies.