trepmal / wp-revisions-cli

WP-CLI command. Manage post revisions.
MIT License
152 stars 24 forks source link

Not touching post meta? #1

Closed markyuk closed 8 years ago

markyuk commented 8 years ago

Hey hey

Loving this and just started using it here :-) Thank you for sharing.

Can I ask - why are you not clearing out old post meta? Seems a bit of a biggy to miss. Going to run a SQL query to clear up just now but wondered why.

alexisbellido commented 8 years ago

@markyuk, I see the revisions are being deleted with wp_delete_post_revision, which is a wrapper for wp_delete_post, and according to the documentation "when the post and page goes, everything that is tied to it is deleted also. This includes comments, post meta fields, and relationships between the post and taxonomy terms."

I suppose that means old post meta is being deleted.

trepmal commented 8 years ago

Just to add, you can use the --hard option on both clean and dump to ensure revisions are deleted with the wp_delete_post_revision() function, which as @alexisbellido mentioned, will also clean up any related data.

On a large site this can take a long time, additionally the related data isn't typically stored for revisions, so the plain clean and dump commands opt for just hitting the posts table.

8ctopus commented 2 months ago

I found this interesting thread on revisions meta data cleanup, I think it's worth having a look before you decide to delete your revisions using this plugin: https://wordpress.org/support/topic/deleting-post-revisions-do-not-use-the-abc-join-code-you-see-everywhere/