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 ( ! $revisions = wp_get_post_revisions( get_the_ID() ) ) {
return $output;
}
$rows="";
foreach ( $revisions as $revision ) {
if ( ! current_user_can( 'read_post', $revision->ID ) ) {
continue;
}
$rows .= "\t<li>" . wp_post_revision_title_expanded( $revision ) . "</li>\n";
}
$output .= "<ul class="post-revisions hide-if-no-js">\n";
$output .= $rows;
$output .= '</ul>';
// At the end of your shortcode function, make sure to..
return $output;