I had a custom type post, for which I changed the url. I have refreshed permalinks and cleared site and browser cache. The old url now redirects to the new url automatically. Possibly because the post ID is the same (?). Is it possible the stop the old url to direct to the new url?

up vote 3 down vote accepted

WordPress uses a function called wp_old_slug_redirect() to find out if you're looking for a post whose slug was recently changed and redirect you to its new home.

If you want to prevent this behaviour for this specific post, delete the _wp_old_slug post meta entry from the database for that post.

If you want to prevent this behaviour for all posts, prevent the function from being used at all:

remove_action( 'template_redirect', 'wp_old_slug_redirect' );

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.