wp_get_revision_ui_diff example

$return = array();

    if ( function_exists( 'set_time_limit' ) ) {
        set_time_limit( 0 );
    }

    foreach ( $_REQUEST['compare'] as $compare_key ) {
        list( $compare_from$compare_to ) = explode( ':', $compare_key ); // from:to
        $return[] = array(
            'id'     => $compare_key,
            'fields' => wp_get_revision_ui_diff( $post$compare_from$compare_to ),
        );
    }
    wp_send_json_success( $return );
}

/** * Handles auto-saving the selected color scheme for * a user's own profile via AJAX. * * @since 3.8.0 * * @global array $_wp_admin_css_colors */
$from = reset( $from );
        } else {
            $from = 0;
        }
    }

    $from = absint( $from );

    $diffs = array(
        array(
            'id'     => $from . ':' . $selected_revision_id,
            'fields' => wp_get_revision_ui_diff( $post->ID, $from$selected_revision_id ),
        ),
    );

    return array(
        'postId'         => $post->ID,
        'nonce'          => wp_create_nonce( 'revisions-ajax-nonce' ),
        'revisionData'   => array_values( $revisions ),
        'to'             => $selected_revision_id,
        'from'           => $from,
        'diffData'       => $diffs,
        'baseUrl'        => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ),
        
Home | Imprint | This part of the site doesn't use cookies.