wpseek.com
A WordPress-centric search engine for devs and theme authors



wp_delete_post_revision › WordPress Function

Since2.6.0
Deprecatedn/a
wp_delete_post_revision ( $revision )
Parameters:
  • (int|WP_Post) $revision Revision ID or revision object.
    Required: Yes
Returns:
  • (WP_Post|false|null) Null or false if error, deleted post object if success.
Defined at:
Codex:

Deletes a revision.

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


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;
}