• Resolved 48733n

    (@48733n)


    Hello everyone,
    I had a custom post type on my WordPress website, but now when I click on shortcut on dashboard panel it is not working anymore and shows “Invalid post type”.
    the shortcut is available on dashboard, but the content and others in “cpt ui” panel is gone. it allows me to create a new one with same name but I need my old contents and should know how to access them? where can i find them? in database or somewhere else?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    What post type is the shortcode leading you to? the slug most specifically. For example is it leading you to a url of /wp-admin/edit.php?post_type=movie where “movie” is the slug in question?

    CPTUI should not have deleted anything, so I have to believe the content is still in the database overall. Sounds like mostly a question of what’s the previous slug for the intended post type and what’s the current one as you say you can re-create, but it’s also not pulling the right content in.

    Everything should be in the database, posts, most meta, and term data if you created some taxonomies as well. We don’t store anything in somewhere custom.

    Thread Starter 48733n

    (@48733n)

    Thanks for your quick response Micheal,
    The slug for my post type was “learning”.
    Now when I want to access /wp-admin/edit.php?post_type=learning it shows “Invalid post type”.
    When I checked the page slugs one of my coworkers created a page with “learning” slug. do you think that caused a problem? how she could do that?!
    I changed the page slug and recreate a new cpt with “learning” slug, everything is fine but the content is still gone. if it exists in my database does it automatically shows in new learning post type or not?
    And should I search post_title in database wp_posts for “learning” to find the old input or not?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Yes, it’s wholly possible to have both a post type slug and an individual page named “learning”. With CPTUI, we do some checks for pages that have a matching name because both the archive and the individual page would be accessed at https://mysite.com/learning/. However, that check requires that the page to exist already. We don’t have any way to prevent a page being named that just because a post type exists with the same.

    It should automatically show again, if the slug is an exact match. If it was named “learnings” originally with that S, and had a permalink rewrite to “learning”, then that’s going to be different from a post type being given a slug of “learning” by default. Just a very basic example with that part. Hard for me to say what the original slug may have been without elevated access, and I would probably do some inspection of the database directly myself. Sounds like you’re willing to do the same though.

    I’d run something like this to get a list of all your post types found in the database:

    select distinct post_type from wp_posts
    

    You should be able to pluck out the slugs from there.

    Thread Starter 48733n

    (@48733n)

    Alright, thank you. I’ll give it a try.
    So if I wouldn’t be able to find “learning” post_type in database I should give up and create new post type and input fresh contents in it, right?

    • This reply was modified 3 years, 1 month ago by 48733n.
    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Not going to say that, it may just have a variation on it from just “learning”. It really depends on what results any of your database queries turn up. If you know/recall one of the post titles for the posts in this original post type in question, that’d also be very beneficial as you could check the post_type column afterwards.

    All really depends on what’s actively available in that database table.

    For ease of switching, especially by UI, I do recommend https://www.ads-software.com/plugins/post-type-switcher/ for touching up posts types, however you need to have the UI for them in the first place before it really makes good use.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Invalid post type’ is closed to new replies.