I have an issue with Canonicalization where on Custom Post Types say for example:
/custom-post-type/{post_id}/fake-post-name/
is loading up but not redirecting to :
/custom-post-type/{post_id}/real-post-name/
It basically is allowing anything to be after post id and load that URL instead of redirecting to the correct one.
Ive got my CPTs setup with custom rewrite rules using 'add_rewrite_rule' and associated my custom post links with 'post_type_link'.
Have I missed a step somewhere?
Many thanks.
Just add to this the actual Canonical tag displays the correct url it should redirecting to.
Will I need to add a filter to canonical_redirect and check the post_name of the CPT and see if it matches for the given post id and pass it back perhaps? Im not sure if this is needed/or way to fix it given the canonical in the is correct?