- This topic has 5 replies, 2 voices, and was last updated 4 years, 8 months ago by
Elvin.
-
AuthorPosts
-
October 6, 2021 at 8:22 pm #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 UINote: 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.October 6, 2021 at 8:54 pm #1955421Elvin
StaffCustomer SupportHi 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.October 6, 2021 at 9:05 pm #1955423Ken
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?
October 6, 2021 at 9:18 pm #1955430Elvin
StaffCustomer SupportI 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. 🙂
October 6, 2021 at 9:54 pm #1955447Ken
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.
October 6, 2021 at 10:10 pm #1955452Elvin
StaffCustomer SupportThanks for sharing it with us.
Glad you got it sorted. No problem. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.