[ 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.

return: string[] 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.

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_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.

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
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.

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. Default 0.

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

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.

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.

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. Whether the revision is an autosave or not.

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.

return: WP_Post|array|null WP_Post (or array) on success, or null on failure.
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'.

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.

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

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.

return: array An array of meta keys to be revisioned.
param: string $post_type The post type being 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.

return: bool Whether the post has 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.

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

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

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

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

return: WP_Post[]|int[] Array of revision objects or IDs, or an empty array if none.
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.

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

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

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

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

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

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
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.

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.

return: WP_Post|false
param: WP_Post $post

_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.

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.

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.

return: int|false
param: WP_Post $revision

_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.

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.

_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.

return: mixed Original meta value if the meta key isn't revisioned, the object doesn't exist,
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.



Generated : Sat Nov 23 08:20:01 2024 Cross-referenced by PHPXref