Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Umocrajen

    (@umocrajen)

    I managed to show the meta on the revision screen for posts with the following code, as you can see the meta_field that im using is called rev_meta, change that to your field

    //State that wp-post-meta-revisions should save our field
    function add_meta_keys_to_revision( $keys ) {
        $keys[] = 'rev_meta';
        return $keys;
    }
    add_filter( 'wp_post_revision_meta_keys', 'add_meta_keys_to_revision' );
    
    //Define the field on the revisions screen
    function extrev_custom_fields($fields)
    {
        $fields['rev_meta'] = 'Revision meta value';
    	return $fields;
    }
    add_filter('_wp_post_revision_fields','extrev_custom_fields');
    
    //For some reason (havent looked into it) the value is in a array, just pick it out
    function extrev_field( $value, $field ) {
    
        $test = $value[0];
        return $test;
    }
    add_filter( '_wp_post_revision_field_rev_meta', 'extrev_field', 10, 2 );

    You can see the result here: https://imgur.com/8iR8q0O

    Please tell me how goofy this is done and how it can be improved, only put 30 min into it.

    Umocrajen

    (@umocrajen)

    I can’t find that Adam states that the meta information will be visible anywhere, this plugins seem to just allow the saving and restoring of post meta along with the revision. So i would say it’s working correctly.

    That being said i also would like to see the meta differences on the compare screen. Maybe this can be included in a future version?

    You can always pull the github repo and try to work it out yourself ??

    Thread Starter Umocrajen

    (@umocrajen)

    Yes, that seems to have resolved the problem! thanks!

    Is there anything more i can do to help you troubleshoot the problem for a fix more permanent then disabling live traffic?

Viewing 3 replies - 1 through 3 (of 3 total)