wp_delete_post_revision( int|WP_Post $revision_id )
Deletes a revision.
Description
Deletes the row from the posts table corresponding to the specified revision.
Parameters
- $revision_id
-
(int|WP_Post) (Required) Revision ID or revision object.
Return
(array|false|WP_Post|WP_Error|null) Null or WP_Error if error, deleted post if success.
Source
File: wp-includes/revision.php
function wp_delete_post_revision( $revision_id ) { $revision = wp_get_post_revision( $revision_id ); if ( ! $revision ) { return $revision; } $delete = wp_delete_post( $revision->ID ); if ( $delete ) { /** * Fires once a post revision has been deleted. * * @since 2.6.0 * * @param int $revision_id Post revision ID. * @param WP_Post $revision Post revision object. */ do_action( 'wp_delete_post_revision', $revision->ID, $revision ); } return $delete; }
Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |
© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_delete_post_revision