Deletes a revision.
Description
Deletes the row from the posts table corresponding to the specified revision.
Parameters
$revision
int|WP_Postrequired- Revision ID or revision object.
Source
function wp_delete_post_revision( $revision ) {
$revision = wp_get_post_revision( $revision );
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;
}
Hooks
- do_action( ‘wp_delete_post_revision’,
int $revision_id ,WP_Post $revision ) Fires once a post revision has been deleted.
Changelog
Version | Description |
---|---|
2.6.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.