I changed post_type and now I receive 404 errors

I changed a custom post_type to a different name. Now when I view a single page with the post_type I receive a 404 page.

How do I debug? Is there a WP log I can view the functions call?

Related posts

Leave a Reply

2 comments

  1. Hi @Christopher Altman:

    Long time, no talk! Hope you and the folks at Matter are doing well.

    When you say you changed the name of the post type, I assume you mean you did so within your theme’s functions.php file within your call to the register_post_type()? If so, did you also run a query in the wp_posts table to update the post_type field? If not you need to run the following query assuming your database prefix is 'wp_' and replacing 'new-type' with 'old-type' as appropriate (I’m assuming you are familiar with where and how to runn a SQL query?):

    UPDATE wp_posts SET post_type='new-type' WHERE post_type='old-type'
    

    Another situation is that you might be using the Redirection plugin? If so, try disabling it as it is known to cause these kind of problems.

    If neither of these if your situation, please give more specifics such as how you defined your custom post type (did you use a plugin) and what steps you took to change? Also show some of the URL paths that are failing.