[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

Post revision functions.

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

Defines 28 functions

  _wp_post_revision_fields()
  _wp_post_revision_data()
  wp_save_post_revision_on_insert()
  wp_save_post_revision()
  wp_get_post_autosave()
  wp_is_post_revision()
  wp_is_post_autosave()
  _wp_put_post_revision()
  wp_save_revisioned_meta_fields()
  wp_get_post_revision()
  wp_restore_post_revision()
  wp_restore_post_revision_meta()
  _wp_copy_post_meta()
  wp_post_revision_meta_keys()
  wp_check_revisioned_meta_fields_have_changed()
  wp_delete_post_revision()
  wp_get_post_revisions()
  wp_get_latest_revision_id_and_total_count()
  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()
  _wp_preview_meta_filter()

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.

param: array|WP_Post $post       Optional. A post array or a WP_Post object being processed
param: bool          $deprecated Not used.
return: string[] Array of fields that can be versioned.

_wp_post_revision_data( $post = array()   X-Ref
Returns a post array ready to be inserted into the posts table 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.
return: array Post array ready to be inserted as a post revision.

wp_save_post_revision_on_insert( $post_id, $post, $update )   X-Ref
Saves revisions for a post after all changes have been made.

param: int     $post_id The post id that was inserted.
param: WP_Post $post    The post object that was inserted.
param: bool    $update  Whether this insert is updating an existing post.

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.

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

wp_get_post_autosave( $post_id, $user_id = 0 )   X-Ref
Retrieves 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.

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

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

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

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

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

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

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

wp_save_revisioned_meta_fields( $revision_id, $post_id )   X-Ref
Save the revisioned meta fields.

param: int $revision_id The ID of the revision to save the meta to.
param: int $post_id     The ID of the post the revision is associated with.

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

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

wp_restore_post_revision( $revision, $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.

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

wp_restore_post_revision_meta( $post_id, $revision_id )   X-Ref
Restore the revisioned meta values for a post.

param: int $post_id     The ID of the post to restore the meta to.
param: int $revision_id The ID of the revision to restore the meta from.

_wp_copy_post_meta( $source_post_id, $target_post_id, $meta_key )   X-Ref
Copy post meta for the given key from one post to another.

param: int    $source_post_id Post ID to copy meta value(s) from.
param: int    $target_post_id Post ID to copy meta value(s) to.
param: string $meta_key       Meta key to copy.

wp_post_revision_meta_keys( $post_type )   X-Ref
Determine which post meta fields should be revisioned.

param: string $post_type The post type being revisioned.
return: array An array of meta keys to be revisioned.

wp_check_revisioned_meta_fields_have_changed( $post_has_changed, WP_Post $last_revision, WP_Post $post )   X-Ref
Check whether revisioned post meta fields have changed.

param: bool    $post_has_changed Whether the post has changed.
param: WP_Post $last_revision    The last revision post object.
param: WP_Post $post             The post object.
return: bool Whether the post has changed.

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

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

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

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

param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
param: array|null  $args Optional. Arguments for retrieving post revisions. Default null.
return: WP_Post[]|int[] Array of revision objects or IDs, or an empty array if none.

wp_get_latest_revision_id_and_total_count( $post = 0 )   X-Ref
Returns the latest revision ID and count of revisions for a post.

param: int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
return: array|WP_Error {

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

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

wp_revisions_enabled( $post )   X-Ref
Determines whether revisions are enabled for a given post.

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

wp_revisions_to_keep( $post )   X-Ref
Determines 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.

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

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

param: WP_Post $post
return: WP_Post|false

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


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

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

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

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.
return: null|array The default return value or the post thumbnail meta array.

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

param: WP_Post $revision
return: int|false

_wp_upgrade_revisions_of_post( $post, $revisions )   X-Ref
Upgrades the revisions author, adds the current post as a revision and sets the revisions version to 1.

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

_wp_preview_meta_filter( $value, $object_id, $meta_key, $single )   X-Ref
Filters preview post meta retrieval to get values from the autosave.

Filters revisioned meta keys only.

param: mixed  $value     Meta value to filter.
param: int    $object_id Object ID.
param: string $meta_key  Meta key to filter a value for.
param: bool   $single    Whether to return a single value. Default false.
return: mixed Original meta value if the meta key isn't revisioned, the object doesn't exist,



Generated : Fri Mar 29 08:20:02 2024 Cross-referenced by PHPXref