Front end URL to restore a post/page
Front end URL to restore a post/page
Front end URL to restore a post/page
Display an old revision of a post in WP front-end theme, are there functions for this?
Basic solution Let’s create new role translator, with capabilities matching capabilities of author role. Insert the code below to functions.php of your current theme: function wpse_add_translator_role() { if ( empty( get_role( ‘translator’ ) ) ) { $role = get_role( ‘author’ ); add_role( ‘translator’, ‘Translator’, $role->capabilities ); } } add_action( ‘init’, ‘wpse_add_translator_role’, 10 ); Once the … Read more
Support auto-save and revisions for custom fields
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.
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 … Read more
The option works from the moment you add it to your wp-config.php file. You can try to remove the old revisions using something like this Just back-up your db first.
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 … Read more
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
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