[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/ -> revision.php (summary)

Post revision functions.

File Size: 862 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 20 functions

  _wp_post_revision_fields()
  _wp_post_revision_data()
  wp_save_post_revision()
  wp_get_post_autosave()
  wp_is_post_revision()
  wp_is_post_autosave()
  _wp_put_post_revision()
  wp_get_post_revision()
  wp_restore_post_revision()
  wp_delete_post_revision()
  wp_get_post_revisions()
  wp_get_post_revisions_url()
  wp_revisions_enabled()
  wp_revisions_to_keep()
  _set_preview()
  _show_post_preview()
  _wp_preview_terms_filter()
  _wp_preview_post_thumbnail_filter()
  _wp_get_post_revision_version()
  _wp_upgrade_revisions_of_post()

Functions
Functions that are not part of a class:

_wp_post_revision_fields( $post = array()   X-Ref
Determines which fields of posts are to be saved in revisions.

since: 2.6.0
since: 4.5.0 A `WP_Post` object can now be passed to the `$post` parameter.
since: 4.5.0 The optional `$autosave` parameter was deprecated and renamed to `$deprecated`.
return: array Array of fields that can be versioned.
param: array|WP_Post $post       Optional. A post array or a WP_Post object being processed
param: bool          $deprecated Not used.

_wp_post_revision_data( $post = array()   X-Ref
Returns a post array ready to be inserted into the posts table as a post revision.

since: 4.5.0
return: array Post array ready to be inserted as a post revision.
param: array|WP_Post $post     Optional. A post array or a WP_Post object to be processed
param: bool          $autosave Optional. Is the revision an autosave? Default false.

wp_save_post_revision( $post_id )   X-Ref
Creates a revision for the current version of a post.

Typically used immediately after a post update, as every update is a revision,
and the most recent revision always matches the current post.

since: 2.6.0
return: int|WP_Error|void Void or 0 if error, new revision ID, if success.
param: int $post_id The ID of the post to save as a revision.

wp_get_post_autosave( $post_id, $user_id = 0 )   X-Ref
Retrieve the autosaved data of the specified post.

Returns a post object with the information that was autosaved for the specified post.
If the optional $user_id is passed, returns the autosave for that user, otherwise
returns the latest autosave.

since: 2.6.0
return: WP_Post|false The autosaved data or false on failure or when no autosave exists.
param: int $post_id The post ID.
param: int $user_id Optional The post author ID.

wp_is_post_revision( $post )   X-Ref
Determines if the specified post is a revision.

since: 2.6.0
return: int|false ID of revision's parent on success, false if not a revision.
param: int|WP_Post $post Post ID or post object.

wp_is_post_autosave( $post )   X-Ref
Determines if the specified post is an autosave.

since: 2.6.0
return: int|false ID of autosave's parent on success, false if not a revision.
param: int|WP_Post $post Post ID or post object.

_wp_put_post_revision( $post = null, $autosave = false )   X-Ref
Inserts post data into the posts table as a post revision.

since: 2.6.0
return: int|WP_Error WP_Error or 0 if error, new revision ID if success.
param: int|WP_Post|array|null $post     Post ID, post object OR post array.
param: bool                   $autosave Optional. Is the revision an autosave?

wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' )   X-Ref
Gets a post revision.

since: 2.6.0
return: WP_Post|array|null WP_Post (or array) on success, or null on failure.
param: int|WP_Post $post   The post ID or object.
param: string      $output Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
param: string      $filter Optional sanitation filter. See sanitize_post().

wp_restore_post_revision( $revision_id, $fields = null )   X-Ref
Restores a post to the specified revision.

Can restore a past revision using all fields of the post revision, or only selected fields.

since: 2.6.0
return: int|false|null Null if error, false if no fields to restore, (int) post ID if success.
param: int|WP_Post $revision_id Revision ID or revision object.
param: array       $fields      Optional. What fields to restore from. Defaults to all.

wp_delete_post_revision( $revision_id )   X-Ref
Deletes a revision.

Deletes the row from the posts table corresponding to the specified revision.

since: 2.6.0
return: WP_Post|false|null Null or false if error, deleted post object if success.
param: int|WP_Post $revision_id Revision ID or revision object.

wp_get_post_revisions( $post_id = 0, $args = null )   X-Ref
Returns all revisions of specified post.

since: 2.6.0
return: array An array of revisions, or an empty array if none.
param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global `$post`.
param: array|null  $args    Optional. Arguments for retrieving post revisions. Default null.

wp_get_post_revisions_url( $post_id = 0 )   X-Ref
Returns the url for viewing and potentially restoring revisions of a given post.

since: 5.9.0
return: null|string The URL for editing revisions on the given post, otherwise null.
param: int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global `$post`.

wp_revisions_enabled( $post )   X-Ref
Determine if revisions are enabled for a given post.

since: 3.6.0
return: bool True if number of revisions to keep isn't zero, false otherwise.
param: WP_Post $post The post object.

wp_revisions_to_keep( $post )   X-Ref
Determine how many revisions to retain for a given post.

By default, an infinite number of revisions are kept.

The constant WP_POST_REVISIONS can be set in wp-config to specify the limit
of revisions to keep.

since: 3.6.0
return: int The number of revisions to keep.
param: WP_Post $post The post object.

_set_preview( $post )   X-Ref
Sets up the post object for preview based on the post autosave.

since: 2.7.0
return: WP_Post|false
param: WP_Post $post

_show_post_preview()   X-Ref
Filters the latest content for preview from the post autosave.

since: 2.7.0

_wp_preview_terms_filter( $terms, $post_id, $taxonomy )   X-Ref
Filters terms lookup to set the post format.

since: 3.6.0
return: array
param: array  $terms
param: int    $post_id
param: string $taxonomy

_wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key )   X-Ref
Filters post thumbnail lookup to set the post thumbnail.

since: 4.6.0
return: null|array The default return value or the post thumbnail meta array.
param: null|array|string $value    The value to return - a single metadata value, or an array of values.
param: int               $post_id  Post ID.
param: string            $meta_key Meta key.

_wp_get_post_revision_version( $revision )   X-Ref
Gets the post revision version.

since: 3.6.0
return: int|false
param: WP_Post $revision

_wp_upgrade_revisions_of_post( $post, $revisions )   X-Ref
Upgrade the revisions author, add the current post as a revision and set the revisions version to 1

since: 3.6.0
return: bool true if the revisions were upgraded, false if problems
param: WP_Post $post      Post object
param: array   $revisions Current revisions of the post



Generated: Sun Apr 28 01:00:03 2024 Cross-referenced by PHPXref 0.7.1