404 ) ); } $post_type = get_post_type( $id ); if ( ! in_array( $post_type, acf_get_internal_post_types(), true ) ) { return new WP_Error( 'acf_invalid_post_type', __( 'Invalid post type selected for review.', 'acf' ), array( 'status' => 404 ) ); } // Disable filters and load the post directly from database. acf_disable_filters(); $post = acf_get_internal_post_type( $id, $post_type ); if ( ! $post ) { return new WP_Error( 'acf_invalid_id', __( 'Invalid post ID.', 'acf' ), array( 'status' => 404 ) ); } // Field groups also load in fields. if ( 'acf-field-group' === $post_type ) { $post['fields'] = acf_get_fields( $post ); } $post['modified'] = get_post_modified_time( 'U', true, $post['ID'] ); $post = acf_prepare_internal_post_type_for_export( $post, $post_type ); // Load local field group file. $files = acf_get_local_json_files( $post_type ); $key = $post['key']; if ( ! isset( $files[ $key ] ) ) { return new WP_Error( 'acf_cannot_compare', __( 'Sorry, this post is unavailable for diff comparison.', 'acf' ), array( 'status' => 404 ) ); } $local_post = json_decode( file_get_contents( $files[ $key ] ), true ); // Render diff HTML. $date_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' ); $date_template = __( 'Last updated: %s', 'acf' ); $json['html'] = '