Clear deleted post types and custom fields from database

Support General Clear deleted post types and custom fields from databaseResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #35746
    EddieEddie
    Participant

    e.g., domain.com/metabox/mb-views - when I delete post type /mb-views and later on create it again, I end up with domain.com/metabox/me-views-2.

    How do I delete post types and custom fields from the database? Caching plugins and server-level cache don't seem to work.

    Thanks

    #35762
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You need to access the database to delete posts and custom fields manually. Or use a third-party plugin to delete them https://wordpress.org/plugins/bulk-delete/

    #37518
    beowulf68beowulf68
    Participant

    Hi Long Nguyen

    I found the following on the internet:

    DELETE p,tr,pm
        FROM wp_posts p
        LEFT JOIN wp_term_relationships tr
            ON (p.ID = tr.object_id)
        LEFT JOIN wp_postmeta pm
            ON (p.ID = pm.post_id)
        WHERE p.post_type = 'article';

    However, I can still see artefacts of the CPT and custom fields. (Admin Menu Pro -> Metabox: I can see the CPT I deleted)

    What is the SQL I can use to completely remove CPT and custom fields.

    Perhaps this should also be a feature in Metabox, since Metabox created the CPT, it should also be responsible for deleting it.

    The 3rd party plugin you recommended does not work without paying for the PRO version (I think), and it does not show you what they are going to delete and ask you to confirm... so it is even more dangerous than SQL (which at least I can do a select and see the rows affected).

    SELECT *
        FROM wp_posts p
        LEFT JOIN wp_term_relationships tr
            ON (p.ID = tr.object_id)
        LEFT JOIN wp_postmeta pm
            ON (p.ID = pm.post_id)
        WHERE p.post_type = 'article';
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.