user1957030
user1957030

Reputation: 31

Delete all "Post Content" from custom post type "Products" through phpmyadmin

Using WordPress and WooCommerce, I'm trying to delete all "Post Content" from the "Products" of woocommerce.

The Products reside in a Custom Post Type "Products" and I don't want to delete post content from blog posts, or pages.

Thank you

Upvotes: 0

Views: 1150

Answers (1)

dustin
dustin

Reputation: 76

I have no experience with WooCommerce, but the query would be:

UPDATE `wp_posts`
SET `post_content` = ''
WHERE `post_type` = 'product'

Replace product with the actual post_type WooCommerce registers products. If you don't know the post_type search for register_post_type() in the plugin files (grep, find in path, ...). If you don't know how to do that, then run the following query:

SELECT `post_type`
FROM `wp_posts`
WHERE `post_type` NOT IN ('post','page','attachment','revision','nav_menu_item')

You will get a list of all custom registered post types.

Upvotes: 2

Related Questions