Title: What is this code ? Help please
Last modified: August 30, 2016

---

# What is this code ? Help please

 *  Resolved [mehmettk](https://wordpress.org/support/users/mehmettk/)
 * (@mehmettk)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/)
 * 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 ?

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [Clayton James](https://wordpress.org/support/users/claytonjames/)
 * (@claytonjames)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846727)
 * 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?q=remove+revisions)
 * [https://wordpress.org/plugins/search.php?type=term&q=optimize+database](https://wordpress.org/plugins/search.php?type=term&q=optimize+database)
 *  Thread Starter [mehmettk](https://wordpress.org/support/users/mehmettk/)
 * (@mehmettk)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846730)
 * Thank you
    I’ve used this code. Does the site impairs ?
 *  Thread Starter [mehmettk](https://wordpress.org/support/users/mehmettk/)
 * (@mehmettk)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846734)
 * This code is incorrect ? wrong code ?
 *  [Clayton James](https://wordpress.org/support/users/claytonjames/)
 * (@claytonjames)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846761)
 * 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.
 *  Thread Starter [mehmettk](https://wordpress.org/support/users/mehmettk/)
 * (@mehmettk)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846808)
 * To remove revisions
 *  [Lee Hodson (VR51)](https://wordpress.org/support/users/leehodson/)
 * (@leehodson)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846817)
 * 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](https://wordpress.org/plugins/).
 *  Thread Starter [mehmettk](https://wordpress.org/support/users/mehmettk/)
 * (@mehmettk)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846821)
 * 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 ?
 *  [Lee Hodson (VR51)](https://wordpress.org/support/users/leehodson/)
 * (@leehodson)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846825)
 * Do not worry about that code. Do not use it. Install the plugin WP Optimize from
   [https://wordpress.org/plugins/wp-optimize/](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.
 *  Thread Starter [mehmettk](https://wordpress.org/support/users/mehmettk/)
 * (@mehmettk)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846835)
 * Thank you 🙂
 *  [Lee Hodson (VR51)](https://wordpress.org/support/users/leehodson/)
 * (@leehodson)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846839)
 * You are welcome.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘What is this code ? Help please’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 10 replies
 * 3 participants
 * Last reply from: [Lee Hodson (VR51)](https://wordpress.org/support/users/leehodson/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/what-is-this-code-help-please/#post-6846839)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
