It’s a MySQL command line code that attempts to remove post revisions ( and clean up other aspects ) from your database.
You may want to explore some of the many plugin options for optimizing and cleaning your database.
https://wordpress.org/plugins/search.php?q=remove+revisions
https://wordpress.org/plugins/search.php?type=term&q=optimize+database
Thank you
I’ve used this code. Does the site impairs ?
This code is incorrect ? wrong code ?
It’s only the wrong code if it doesn’t do exactly what you wanted it to do. My advice would be not to use code if you don’t have any idea what it does.
Try the plugins WP Optimize or WP Sweep. Both plugins remove post revisions and help with database maintenance. You can find them in the WordPress plugin repo.
DELETE p, r, m
FROM wp_posts p
LEFT JOIN wp_term_relationships r ON (p.ID = r.object_id)
LEFT JOIN wp_postmeta m ON (p.ID = m.post_id)
WHERE p.post_type = ‘revision’;
What does this code ? I do not understand ?
Do not worry about that code. Do not use it. Install the plugin WP Optimize from https://wordpress.org/plugins/wp-optimize/. This is easier for you.
About the Code
When you write a post or page using WordPress. WordPress records a copy of the post. The copy of the post is called a ‘snapshot’. The snapshot is taken every 2 or 3 minutes. This snapshot is also called a ‘post revision’.
The code you asked about. This code is used to remove the old post snapshots (post revisions).
You do not need to use the code.