Site logo

[Resolved] Advice on How to Delete ALL Custom Post Code and Delete Two CPT Plugins

Home Forums Support [Resolved] Advice on How to Delete ALL Custom Post Code and Delete Two CPT Plugins

Home Forums Support Advice on How to Delete ALL Custom Post Code and Delete Two CPT Plugins

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1955403
    Ken

    Hi. Can you guide me on how to go about deleting from my wordpress site ALL custom post type code from php as well as being able to delete the following plugins?
    Advanced Custom Fields
    Custom Post Type UI

    Note: I had 5 custom posts set up.

    What I’v done:
    In the Advanced Custom Fields I deleted all the 5 field groups AND I was able to delete the plugin.
    However,
    In the CPT UI, after I deleted all 5 of the Custom Posts when I deactivate Custom Post Type UI plugin, I get ‘Fatal Error” on my website. When I re-activate it, the site loads fine. See image link in Private Information.

    VDO of PHP files
    Screenshot of Fatal Error when deactivating CPT UI.

    #1955421
    Elvin
    Staff
    Customer Support

    Hi Ken,

    The easy way out is by using WP Reset and wiping the site clean.

    But since that’s undesirable in some cases and there are ways to delete specific post types, here’s a few things to ponder on:

    For advanced users, normally this is done by accessing wpdb (WordPress database.)

    Database CLIs generally let you execute deletion of entries with specificity. (deleting entries on tables with specific values)

    But if you’re unsure how to do this, consider doing it with a UI of a plugin that does it for you.
    Example: https://wordpress.org/plugins/bulk-delete/

    You can also try deleting all with a PHP snippet.

    Example:

    $allposts= get_posts( array('post_type'=>'movies','numberposts'=>-1) );
    foreach ($allposts as $eachpost) {
      wp_delete_post( $eachpost->ID, true );
    }

    This deletes all posts of post type with slug movies.

    #1955423
    Ken

    I’m not sure if I understand. Note: I have already replaced the Custom Post Types as there were not that many and, in addition, I set up a 301 direct for each custom post type that was made to redirect to the new post that used the WP regular post.

    I just was wondering how to clean up the files I showed you in the VDO. That can I just go ahead and delete the Product and Content php files first and then go to the functions.php and delete the selected code I showed in the VDO.

    OR

    I really do need to access the wpdb to delete this php files?

    #1955430
    Elvin
    Staff
    Customer Support

    I just was wondering how to clean up the files I showed you in the VDO. That can I just go ahead and delete the Product and Content php files first and then go to the functions.php and delete the selected code I showed in the VDO.

    Ah yes, about those files. Yeah you really have to delete them manually.

    I’d wipe the functions.php clean and delete the CPT template .php files. 😀

    There’s no need for wpdb if it’s just these files. It’s simple FTP. 🙂

    #1955447
    Ken

    Hey Elvin,
    Thank you for confirming. Done! Site is still running. ٩( ᐛ )و
    By the way I found an out-dated ‘Custom Post Type Plugin. WOW! I had files that go back 5 years ago.
    Here’s the link to the plugin for anyone who’s interested
    https://wordpress.org/plugins/custom-post-type-cleanup/

    And here’s a link to the VDO that help me find and use this nifty plugin.

    Thanks again for your help.

    #1955452
    Elvin
    Staff
    Customer Support

    Thanks for sharing it with us.

    Glad you got it sorted. No problem. 😀

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.