• Resolved Malae

    (@malae)


    Hello Rolf,
    I have been using this plug-in for several years on two CMS sites and have found it very useful. My sites’ contents are fairly static and to save space I reduced the number of revisions kept to only 1.

    Yesterday I did some revisions to coding and was removing the revisions as I progressed. On going to another page, when I opened Edit I noticed that there were no revisions showing. I waited for auto save and nothing happened. I disabled all plug-ins but no revisions for any page. I have never set to 0 revisions kept.

    After activating all the plug-ins and I changed the settings to keep 2 revisions. I then saved and the revision appeared with an autosave revision. This problem is the same for both sites and is repeatable, when switching from 1 to 2 and back to 1 for kept revisions.

    I had a real panic when I could not find the revisions, so at present will keep the setting as 12 kept revisions.

    https://www.ads-software.com/plugins/rvg-optimize-database/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor cageehv

    (@cageehv)

    Hey Malae,

    That’s some strange ‘feature’ of WordPress…

    For some reason, on the edit a post or page admin pages, it only shows revisions if there are MORE than one revision.
    No idea why that is…

    I hope this answers your question!

    peace,
    Rolf

    Thread Starter Malae

    (@malae)

    My last sentence was in error, I am keeping 2 revisions.

    I did not ask a question in my previous posting, I simply related what had happened and I am not satisfied that is just a strange a strange feature of WordPress.

    Now I will ask some questions:
    Has this happened before, or did you try to see, if this happens, when you select ‘keep 1 revision’?

    I don’t think you should simply blame the anomaly on WordPress, so could you try to check what is happening? For technical reasons, I would like to use the setting at keep 1 revision.

    Plugin Contributor cageehv

    (@cageehv)

    Hey Malae,

    In the WordPress core is hard coded that there at least have to be 2 revisions before they are shown on the edit page:

    File: edit-form-advanced.php
    
    if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
    	$revisions = wp_get_post_revisions( $post_ID );
    
    	// We should aim to show the revisions meta box only when there are revisions.
    	if ( count( $revisions ) > 1 ) {
    		reset( $revisions ); // Reset pointer for key()
    		$publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );
    		add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
    	}
    }

    I have no idea if that’s on purpose or if it’s a bug.

    The fix would be to replace the line
    if ( count( $revisions ) > 1 ) {
    with
    if ( count( $revisions ) >= 1 ) {

    But I don’t want to hack into the WP core with my plugin, that’s too tricky with upgrades…

    peace,
    Rolf

    Plugin Contributor cageehv

    (@cageehv)

    Hey Malae,

    Found it.
    Here is explained why:
    https://core.trac.www.ads-software.com/ticket/26577

    peace,
    Rolf

    Thread Starter Malae

    (@malae)

    Hello Rolf,

    Many thanks for your taking the time to show me the WP code.

    I have also just read the explanations that you also sent. Thank you again for digging this up for me. Its getting late where I am and I will go through it in more detail tomorrow.

    There are reasons why this is a bit of a problem for me. I will explain further via your e-mail.

    Doei.

    Thread Starter Malae

    (@malae)

    If I understand correctly from the above, setting the plug-in to keep 1 revision, would be pointless, because it would eventually allow any previous revision to be replaced by the autosave revision, thus it will be the same as the page last opened in Edit mode.

    Now that I have reset to keep 2 revisions, I have no revisions differing from the present page, until I update the page. May I suggest that the plug-in does not allow a choice of < 2 revisions, to avoid the issue of no revisions showing, when one would be expected to show and to avoid the loss of a potentially useful previous revision.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Revisions to keep: 1, shows none’ is closed to new replies.