Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_delete_post_revision ›

Od2.6.0
Przestarzałyn/a
wp_delete_post_revision ( $revision_id )
Parametry:
  • (int|WP_Post) $revision_id Revision ID or revision object.
    Wymagane: Tak
Powrót:
  • (array|false|WP_Post|WP_Error|null) Null or WP_Error if error, deleted post if success.
Zdefiniowane na:
Codex:

Deletes a revision.

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



Źródło

function wp_delete_post_revision( $revision_id ) {
	if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
		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 object|array $revision    Post revision object or array.
		 */
		do_action( 'wp_delete_post_revision', $revision->ID, $revision );
	}

	return $delete;
}