post_type_link filter causes 404 on the CPT page it’s used on

post_type_link is a filter that is applied to the URL for a post before it’s returned by get_post_permalink.

So it doesn’t change any rewrite rules and the structure of permalinks is still the same.

So yeah – if you use it to change the structure of links, you have also to change the rewrite rules in such way, that the new link is matched and processed correctly.

Leave a Comment