Hi,
I have a custom page template for products (see link) which is shown for any url like “/products/”. I use add_action( ‘template_include’) to redirect these URLs to the template file. In the template file I use the following filters to change the metadata so they do not default to the blog page metadata:
add_filter(‘pre_get_document_title’)
add_filter( ‘rank_math/frontend/title’)
add_filter( ‘rank_math/frontend/description’)
add_filter( ‘rank_math/frontend/canonical’)
add_filter( ‘rank_math/opengraph/url’)
All of them work correctly except the canonical filter, which is still showing a canonical of the blog page. I suspect this is because the filter is applied earlier in the loop. Can you confirm this?
How can I fix this? Is it a bug?
The page I need help with: [log in to see the link]
