As WordPress since version 4.6.1 or so ignores
define('WP_POST_REVISIONS', false); definition (at least in my WP instance), it tries to make as much revisions as possible.
Even if a post or a WooCommerce product was opened for just
CTRL+A -> CTRL+C and then closed without editing, in most cases I'll get a nice but totally unneeded revision entry in the database for that particular post.
As I don't think it is a good idea to forcibly delete anything directly in mySQL database I'd better turn revisions into post drafts or product drafts using the following not so difficult SQL query:
UPDATE `wp_posts` SET `post_date` = '2222-12-31 00:00:00' WHERE `wp_posts`.`post_type` = 'revision'; UPDATE `wp_posts` SET `post_status` = 'draft' WHERE `wp_posts`.`post_type` = 'revision'; UPDATE `wp_posts` SET `post_type` = 'post' WHERE `wp_posts`.`post_type` = 'revision';
But unfortunately both post revisions or product revisions look absolutely the same in
wp_posts table comparing their
post_type entries, so the product revisions turn into post drafts after applying the above query.
So my question is how could I detect WooCommerce product revisions and turn them into product drafts before doing the same for post revisions?