Getting post revision and printing them on the post content site
Getting post revision and printing them on the post content site
Getting post revision and printing them on the post content site
I’m not 100% sure exactly what you wish to place in the ‘last revision’ column, but just so you are aware you can switch the view on the Posts table to Excerpt View using the button below the search box. This view allows you to see the first few lines of the post as well … Read more
I resolved this in the end by removing access to the revisions meta box for certain user types… if (get_current_user_role()==”custom_user_role”){ function my_remove_revisions() { remove_meta_box(‘revisionsdiv’, ‘apartments’, ‘normal’); } add_action( ‘admin_menu’, ‘my_remove_revisions’ ); }
To get the_modified_author() we have to look in the folder wp-includes and search for the author-template.php. Line 101 shows: /** * Display the name of the author who last edited the current post, * if the author’s ID is available. * * @since 2.8.0 * * @see get_the_author() */ function the_modified_author() { echo get_the_modified_author(); } … Read more
Check your database to see if the revisions are still there. Use phpmyadmin or another database tool and go to wp_posts table and search for post_type = revision. If they are not there, they are gone. A lot of “optimization” plugins remove post revisions for you. I would check if any of your plugins has … Read more
You should have a nonce provided by your WP instance, and of course, being authenticated previously (through cookies, set by the wp-login normal process, a JWT, or even Basic authentication). This is because some requests are not approved if they come without the nonce, in order to prevent abuse. So, you could pass to your … Read more
I don’t think you should define constants in your plugin. It will be very hard to debug later on. IMHO using wp_revisions_to_keep filter will be much nicer solution. So your code could look like this: add_filter( ‘wp_revisions_to_keep’, ‘my_revisions_to_keep_based_on_settings’, 10, 2 ); function my_revisions_to_keep_based_on_settings( $num, $post ) { // change that according to your needs return … Read more
Post revisions have the original post as their parent, so you can get the post type by checking the post type of the revision’s parent: $revision = wp_get_post_revision( $id ); $post_type = get_post_type( $revision->post_parent );
Revisions are stored as posts in the *_posts table(s). This shouldn’t be touched during a conversion to Multisite. I just did a quick test on my local machine: Installed WordPress Added a couple pages and posts Revised the pages and posts Made sure the revisions were stored in the DB Ran the Multisite conversion from … Read more
Your shortcode calls wp_list_post_revisions() which echo the output (revision list), hence you get the “updating error”. To fix the issue, you can use output buffering like so: ob_start(); wp_list_post_revisions( get_the_ID() ); $revisions = ob_get_clean(); Or you could use wp_get_post_revisions() and build the HTML list manually. Here’s an example based on the wp_list_post_revisions(): $output=””; if ( … Read more