Public (Non-Admin) Post Edit/Revision History

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

Is it possible to set custom post type revision limit inside the theme files?

I had a look at the wp_revisions_to_keep() function. There’s a filter called wp_revisions_to_keep that overrides the value of WP_POST_REVISIONS. Here’s an untested example (PHP 5.4+): add_filter( ‘wp_revisions_to_keep’, function( $num, $post ) { // Post Types and Revision Numbers – Edit to your needs $config = [ ‘post’ => 10, ‘page’ => 9, ‘cpt’ => 8 … Read more

How can we publish revisions of a post, in addition to showing the latest post?

I suggest you look at https://codex.wordpress.org/Function_Reference/wp_get_post_revisions <?php // Lets get the revisions of the given $post we are accessing by ID ( you are probably going to want to limit your internal revision count for this $revisions = wp_get_post_revisions($post->ID); // lets just do some formatting here ( your post html content is going to display … Read more

Define maximum number of revisions per post type?

I might be wrong, but my first guess would be that this is not easily possible, because number of revisions gets saved into constant and does not seem hook-able. From quick search relevant checks are in wp_save_post_revision() and it’s very rigid.

Autosave control in WordPress

Autosave: Autosave is simply about saving your posts automatically in the background while you are editing. So it’s different from revisions and for every post there will be only one autosave per user. This is from the document: There is only ever a maximum of one autosave per user for any given post. New autosaves … Read more

Is there a way to get a revision count of a post?

You can use wp_get_post_revisions ( int|WP_Post $post_id, $args = null ). It returns an array of revisions for the passed post ID or an empty array if a passed post does not have any revisions. Note that the $args parameter accepts all parameters valid for WP_Query $q = wp_get_post_revisions( 513 ); echo count( $q ); … Read more

revert one revision of a post progmattically via code?

So via lots of head banging and experimentation I managed to get a solution to letting editors/admins review the post whilst a previous one stays live is rather convoluted but does work. The key thing I did was to create a new post status which I call awaiting. In the admin it appears as “changes … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)