Hi Garik
Let me step in here while Christopher is off today.
Firstly, sorry about that code snippet for deleting the surplus field groups, it contains a typo and should read like so:
$wcfgs = get_posts( array(
'post_type' => 'wp-types-group',
'title' => 'Toolset WooCommerce',
'numberposts' => 25
));
foreach ($wcfgs as $key => $wcfg) {
wp_delete_post( $wcfg->ID, true );
}
The staging site you created for Christopher no longer seems to be available, so I took a copy of your site to do some testing locally. I used the ammended snippet there, and it successfully eliminates the surplus field groups, and no others.
I haven't been able to identify what causes the extra groups to be created, however.
I know why they are created, but not what triggers it.
Specifically, we run a query to check whether the field group exists or not, and if not we create it.
The problem with the previous client was that they had a custom plugin which indiscriminately modified queries on the product and order listing pages that affected our query and meant it always found zero existing field group posts, prompting us to create one.
Something similar must be happening on your site, but I'm not sure what the trigger is. I've tried to isolate a plugin that may cause the problem on the same back end pages, but no extra field groups are being created.
All I can suggest is that you keep an eye on this when navigating your site, and periodically check whether the additional field groups are generated, to see if you can spot the action required to trigger their creation. If you find something let us know, we may be able to find the cause within the corresponding code.
As an aside, I thought you may want to do some house-keeping on your site. The package created was extremely large, and checking the installation locally, I see that you have one very large database table in particular, relating to one of your plugins. I'd double-check whether it is really needed.
I'll keep a copy of your site locally so that if you find an action that triggers the problem I can try to reproduce it.