Displaying a List of Changes / Updates on the Website Publicly
I was wondering if there was some way to display / track down the recent changes for the pages (and possibly posts).
I mean, showing admin updated x page Jan. 15, 2022 3pm. Something like my old site. This is the current site.
Maybe I'm asking too much but I also would like to reflect what was exactly updated as well.
I must clarify that I don't want this to be only seen internally, I want it to be shown for the public.
I asked somewhere else and a guy replied and he gave me this code:
add_filter('the_content', 'append_revision_info_to_the_content', -1);
function append_revision_info_to_the_content( $content ) {
if( ( is_single() || is_page() ) is_main_query() in_the_loop() ) {
$revisions = wp_get_post_revisions(get_the_ID());
$content .= wp_kses_post(section class='revisions');
// loop through all revisions for current post/page
foreach($revisions as $revision) {
// for each revision...
// ...let's store revision author
$revision_author = get_user_by('id', $revision-post_author);
// ...and add author and revision date/time with some html structure to the post/page content
$content .= wp_kses_post(div class='revision'Revision by span . $revision_author-user_login . /span edited at span . $revision-post_modified . /span/div);
}
$content .= wp_kses_post(/section);
return $content;
}
}
Unfortunately, the code didn't work and add that the communication fell off when the guy stopped replying to my messages. I still have no idea why it's not working.
Best regards.