admin管理员组

文章数量:1277886

Couple of days ago I was checking the size of my database and I was amazed on how huge it is. The most weird thing for me is that my site is not using comments, and still the wp_comment table is more 27MB. When I took a look inside I saw this for example - a comment from Woocommerce saying this in the content - Order status changed from Pending Payment to Proce... or this IPN payment completed.

Now I use many plugins on the site, but I`m still not sure why orders status should be in wp_comments. Also in the backend of WordPress, there are zero comments in spam, approved or trash...

What shall I do? Shall I remove all comments there? I thought Wordpress is writing in the orders tables for this purposes...

Couple of days ago I was checking the size of my database and I was amazed on how huge it is. The most weird thing for me is that my site is not using comments, and still the wp_comment table is more 27MB. When I took a look inside I saw this for example - a comment from Woocommerce saying this in the content - Order status changed from Pending Payment to Proce... or this IPN payment completed.

Now I use many plugins on the site, but I`m still not sure why orders status should be in wp_comments. Also in the backend of WordPress, there are zero comments in spam, approved or trash...

What shall I do? Shall I remove all comments there? I thought Wordpress is writing in the orders tables for this purposes...

Share Improve this question asked Jan 29, 2018 at 13:43 Droid SheepDroid Sheep 811 silver badge7 bronze badges 1
  • 1 Reviews and Order Notes are stored as comments. WooCommerce automatically creates order notes for things like status changes. – Jacob Peattie Commented Jan 29, 2018 at 14:09
Add a comment  | 

2 Answers 2

Reset to default 1

Oh, that is double offtopic, but for the sake of helping other people which might wonder the same about EDD and maybe other plugins, the reason is because wordpress core to not have any easy support for hierarchy between CPTs except for comments being under posts. As orders are "belonging" to specific products it makes a simple hack to emulate such a relationship by using comments.

Why not just store order in separate table? because on wordpress which is one of the biggest wordpress hosters in the world plugins are not allowed to create new table, therefor WC and EDD had to come up with some hack.

What should you do? probably nothing, why do you even look at the DB in the first place? Checking out the architecture of code is something you should do before putting it on production. After it was running for a while it becomes too late to think about alternatives.

That is just the way WordPress "forces" plugins like WooCommerce to work. But some people frustrated with the performance impact of this have developed this plugin to make WooCommerce use custom tables, properly indexed. Give it a go in a test environment first.

本文标签: databaseWhy is Woocommerce writing in my wpcomment table