lesterchan / wp-sweep

WP-Sweep allows you to clean up unused, orphaned and duplicated data in your WordPress. It also optimizes your database tables.
https://wordpress.org/plugins/wp-sweep/
153 stars 22 forks source link

Orphaned Term Relationship are not deleted #1

Closed slaFFik closed 9 years ago

slaFFik commented 9 years ago

At all. Doing something quite long.

Than shows this messages: 8 Orphaned Term Relationships Processed Although in a table I see this: Orphaned Term Relationship - 8003

Initially posted here: https://wordpress.org/support/topic/orphaned-term-relationship-are-not-deleted?replies=1

lesterchan commented 9 years ago

Let's discuss it over here. It works fine on my host but I only tested on one site since I don't have access to more big sites.

It takes a long time for huge sites because it does a sub query. If you click Sweep a couple of times, does it process the remaining one or it is stuck at 8003 orphaned term relationship?

Can you run this query and tell me the output?

SELECT tr.object_id, tr.term_taxonomy_id, tt.taxonomy FROM wp_term_relationships AS tr INNER JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy != 'link_category' AND tr.object_id NOT IN (SELECT ID FROM wp_posts) LIMIT 100;
slaFFik commented 9 years ago

It sticks to that number. Here is the output: http://pastebin.com/MNPdS6i3

lesterchan commented 9 years ago

Cool, thanks. I can reproduce it with the data. I will fix it tomorrow and update here again.

lesterchan commented 9 years ago

@slaFFik fixed, can you try download the zip file https://github.com/lesterchan/wp-sweep/archive/master.zip and replace wp-sweep.php to the plugin folder to see if it works now before I release 1.0.2 to the public?

slaFFik commented 9 years ago

Tested. Works fine.