WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/ wp post revision fields


This function's access is marked as private. That means it is not intended for use by plugin and theme developers, but only in other core functions. It is listed here for completeness. Use any of these functions instead.

Description

Returns the fields that will be compared when post revisions are diffed.

Note: This function is for use by other core functions only, and should not be used in plugins or themes. It is included here for completeness.

Determines which fields of posts are to be saved in revisions. If passed a post array, it will return a post array ready to be inserted into the posts table as a post revision. Otherwise, it returns an array whose keys are the post fields to be saved for post revisions.

Usage

 <?php _wp_post_revision_fields$post$autosave ); ?> 

Parameters

$post
(array) (optional) A post array to be processed for insertion as a post revision.
Default: null
$autosave
(boolean) (optional) Is the revision an autosave?
Default: false

Return Values

(array) 
Array of key-value pairs where the key is the field slug and the value is the field title. Or, if passed a post array, a post array ready to be inserted as a post revision.

Examples

Using the function to get the list of revision fields:

foreach ( _wp_post_revision_fields() as $field => $field_title ) : /* ... */

Using the function to prepare a post for insertion into the database as a revision:

$post = _wp_post_revision_fields( $post );

For an autosave:

$post = _wp_post_revision_fields( $post, true );

Changelog

Since: 2.6

Source File

_wp_post_revision_fields() is located in wp-includes/revision.php