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 normally but lets get the var_dump to look decent
            echo '<pre>';
            //  print the $revisions variable to look at the internals
            var_dump($revisions);
            echo '</pre>';

            // from here i would dig into iterating over the revisions array.
            ?>

using the above code inside your loop should get your started to see what kind of data you can return from wp_get_post_revisions(). You are going to need to do some searching on the post_date portion or look at the array key and sort by the integer and push to a custom array where key matches count() to return only the most recent post revision. This query will be huge so i sincerely suggest you limit your wordpress installs revision count.

Leave a Comment