Tag Info

Hot answers tagged

5

This is a much safer query to use and will remove related entries from the postmeta and term_relationship, unlike deathlocks query in his answer. Change the {id} to the id of each blog posts table. You can combine this query to run all the post tables at once, but try this on one table first. I've used it many times on single WP installs. DELETE a,b,c FROM ...


4

If you don't have control over the post type registration, you an use the remove_post_type_support() function: add_action('admin_init', 'disablew_revisions'); function disable_revisions(){ remove_post_type_support('post', 'revisions'); } If you also wish to disable autosave for specific post types, you can do this: add_action('admin_print_scripts', ...


4

Michael Adams, Quantum Bug Creator at Automattic once said: "Revisions are stored in the posts table. I don't yet know what kind of impact that will have on post queries. We're going to turn the switch to "on" on WordPress.com sometime soonish and we'll have a better idea about what kind of damage, if any, it does." And sometime later they did ...


3

Remove the revisions property inside the supports parameter of register_post_type(). Example $args = array( // ... 'supports' => array('title','editor','thumbnail','comments','revisions') ); register_post_type('book',$args); Change to: $args = array( // ... 'supports' => array('title','editor','thumbnail','comments') ); ...


3

Every time you edit a post/page, WordPress creates timely revisions of it. Check the Firebug console for the requests that are sent at regular intervals when you are on the edit page. They are useful if you lose the post content at some point and want to get back to an earlier version of the post. Once you publish the final version of the post then you can ...


3

It all depends on your workflow. If you have no use for the post revisions and autosaves then disable them in wp-config and WordPress will clean them up on its own. You may also prefer to limit how many you keep at once. Also the space they take up is unlikely to be of a great impact itself unless you're running on a tiny tiny server Don't go deleting them ...


2

Probably is a way with an SQL query. But another solution is to use Search RegEx, which is a good plugin to be able to search and replace with grep and regular expressions through all posts and pages. And I'd delete all your revisions to make sure the links aren't hidden in old revisions that might get restored at some point. If you need to develop a regex ...


2

It took me a while but I got it! This works as follows: Since you have no reference to the post other than the URI, we segment out the URI to check for a page with that page_name If there is a page, we get the latest revision child Hack the query to force our revision slug to source the page This works swell because it gives the appearance of a working ...


2

Set custom autosave interval Just define it in your wp-config.php file // Allow revisions define( 'WP_POST_REVISIONS', true); // Set number of ms define( 'AUTOSAVE_INTERVAL', 300 ); Note that this means that you'll get a lot of queries and post revisions. Therefore you should also add a max. number of revisions to not fill your posts table with stuff you ...


2

There is also a plugin that can help you do this http://wordpress.org/extend/plugins/wp-optimize/ From the website: WP-Optimize is a WordPress 2.9++ database cleanup and optimization tool. It doesn't require PhpMyAdmin to optimize your database tables. It allows you to remove post revisions, comments in the spam queue, un-approved comments within few ...


1

This is not yet a complete answer, for lack of time, though I'll try to return later with a more complete example but I just wanted to add a couple of notes. Possibly someone else will jump in soon. To get the ball rolling... Firstly, Yes this is entirely possible, you can create this functionality and in your snippet you'll see some of the relevant ...


1

No, wp-config.php can have granular constants. Like this: if ( 'example.com' == $_SERVER['HTTP_HOST'] ) { define( 'WP_POST_REVISIONS', 1 ); } elseif ( 'blog1.example.com' == $_SERVER['HTTP_HOST'] ) { define( 'WP_POST_REVISIONS', 5 ); } elseif ( 'blog2.example.com' == $_SERVER['HTTP_HOST'] ) { define( 'WP_POST_REVISIONS', 10 ); }


1

Your question specifies that you are looking for 'suggestions' so this answer is in that category rather than in the 'working code' category. I am going to start by saying that I don't know if this is a good idea. You are going to multiply the size of your database many times over. Now that is off my chest, if you are going to proceed here are my thoughts. ...


1

you can grab revisions from wpdb with smth like $revisions = $wpdb->get_results("select * from {$wpdb->posts} where post_parent={$post_id} and post_type='revision'") after selecting a revision you could use some js diff tool like http://cemerick.github.io/jsdifflib/demo.html


1

You should set WP_POST_REVISIONS to a fixed number. If you don’t, WordPress will keep an unlimited number of revisions. See function wp_revisions_to_keep(): function wp_revisions_to_keep( $post ) { $num = WP_POST_REVISIONS; if ( true === $num ) $num = -1; else $num = intval( $num ); if ( ! post_type_supports( ...


1

To address: What will happen to these posts if I set WP_POST_REVISIONS to 10? Will old versions be deleted automatically, or will they remain? You have this action: add_action( 'pre_post_update', 'wp_save_post_revision' ); set by default in /wp-includes/default-filters.php. If you check the source of wp_save_post_revision() you can see that it ...


1

Is it safe to directly delete all rows in the wp_posts table that have a post_type of revision? (I've seen conflicting answers on this—but I'd love to be able to just do it this way if it's safe) Safe, it's safe. If there is only one user (you) that can edit posts on site it's safe and does not bring any other problem. If there are more, and one ...


1

You can prevent more than three revisions from being saved to the database in the future by adding this line to your wp-config.php file: define( 'WP_POST_REVISIONS', 3 ); That line should limit new posts to three revisions, but it won't go through your database and clean it up. The SQL snippet that you found for deleting old revisions from the WordPress ...


1

As of now the Post Type Switcher plugin is causing this problem. (See this forum post.) After deactivating the plugin, I ran the following to update the database: UPDATE `wp_posts` set `post_type` = "revision" WHERE (`post_name` LIKE "%revision%" OR `post_name` LIKE "%autosave%") AND `post_status` = "inherit" AND `post_parent` != 0 AND `post_type` ...


1

You could try CF Revision Manager, a library for this job. See also the GitHub repo. I haven't used it, so I cannot offer code examples. There is also the very fresh Trac ticket #20564 where Alex is asking to get this functionality into the core.


1

This is possible but it's not as simple as changing the WP_POST_REVISIONS property in the wp-config.php. This is possible by adding a filter to the 'wp_insert_post_data'. Adding a filter is done like this: add_filter('wp_insert_post_data' , 'my_insert_post_data'); function my_insert_post_data($data , $postarr) { // Check the revision stuff return ...


1

Remove the action 'wp_save_post_revision' from 'pre_post_update'. It is set per default in wp-includes/default-filters.php with the default priority (10). Add your own function to this hook. You get the $post_ID as parameter, so detecting the post type is easy. In your callback copy the code from wp_save_post_revision() but use the constant ...


1

I just wasted a lot of time figuring this out. There are number of things a user should rule out first. Deactivate any plugins and switch to a default theme like twenty-thirteen if the below items do not work. To make sure that you don't have revisions turned off, be sure this does not exist in wp-config.php: define('WP_POST_REVISIONS', false); While on a ...


1

When you register your CPT, you need to manually add support for revisions. Only title and editor are set as defaults. Check out the codex. So if you need to enable revisions, you need to add it like this 'supports' => array( 'title', 'editor', 'revisions' ), in your $args = array() when registering your CPT. Just for info, here are the other arguments ...



Only top voted, non community-wiki answers of a minimum length are eligible