woof_seo_canonical
Filters the canonical URL link tag that is output in the page head section during active filter searches, allowing customization of the canonical URL.
Parameters
$canonical_url (string) — The cleared base URL (without query parameters) of the current filter search page
Source File
ext/url_request/classes/seo.php:376
Code Example
add_filter('woof_seo_canonical', function($url) {
// Force HTTPS for canonical
return str_replace('http://', 'https://', $url);
});
Usage Notes
- Outputs <link rel="canonical" href="..." /> in wp_head.
- When do_index() is true, Yoast's canonical is suppressed and the cleared URL with search params may be used.
- The URL is the base path without query string, derived from get_cleared_url().