Recent

Revisionsclass

Revisions

Revisions class.

Namespace: WebberZone\AutoClose\Features
Since: 3.0.0
Source: includes/features/class-revisions.php line 17

Methods

__construct()

Constructor.

Since: 3.0.0
Line: 41

public function __construct(  );

process_revisions()

Process revisions based on settings.

Since: 3.0.0
Line: 50

public function process_revisions(  ): array;

Returns: array

get_revision_age()

Number of days a revision must exceed before ordinary pruning removes it.

Since: 3.2.0
Line: 99

public function get_revision_age(  ): int;

Returns: int — Age in days. Zero disables the age condition.

get_prune_limit()

Maximum number of revisions a single pruning run may delete.

Since: 3.2.0
Line: 110

public function get_prune_limit(  ): int;

Returns: int — Bound for one run. Zero removes the bound.

get_preview()

Preview revision cleanup without changing content.

Since: 3.2.0
Line: 132

public function get_preview( int $sample_limit = ..., $post_ids = ..., bool $respect_setting = ..., string $mode = ... ): array;
Type Name Description
int $sample_limit Maximum sample rows.
array|string $post_ids Optional parent post IDs to limit the preview.
bool $respect_setting Whether to skip when deletion is disabled.
string $mode Either prune for the retention and age policy, or all for delete-all.

Returns: array — Preview data.

get_prune_preview()

Preview the revisions an ordinary pruning run would delete.

Since: 3.2.0
Line: 167

public function get_prune_preview( int $sample_limit = ..., $post_ids = ..., ?int $age_days = ..., ?int $limit = ... ): array;
Type Name Description
int $sample_limit Maximum sample rows.
array|string $post_ids Parent post IDs.
int|null $age_days Age cutoff in days. Null uses the saved setting.
int|null $limit Maximum candidates to collect. Null uses the filtered default.

Returns: array — Preview data.

prune_revisions()

Delete revisions that exceed the retention limit and the age cutoff.

A revision is pruned only when it is beyond the effective number of revisions the post keeps and is strictly older than the age cutoff. Autosaves are never pruned, matching how core skips them when trimming.

Since: 3.2.0
Line: 275

public function prune_revisions( array $args = ... ): array;
Type Name Description
array $args {

Returns: array — Pruning result.

delete_revisions()

Delete every post revision, ignoring retention limits and the age cutoff.

This is the explicit delete-all action. Ordinary scheduled cleanup uses prune_revisions() instead.

Since: 3.0.0
Line: 616

public function delete_revisions( $post_ids = ... ): int|bool;
Type Name Description
array|string $post_ids Optional parent post IDs to limit the deletion.

Returns: int|bool — Number of revisions deleted. Boolean false when anything failed.

delete_all_revisions()

Delete every post revision and report what happened.

Same operation as delete_revisions(), but reports partial progress and the reason for a failure instead of collapsing to boolean false.

Since: 3.2.0
Line: 633

public function delete_all_revisions( $post_ids = ... ): array;
Type Name Description
array|string $post_ids Optional parent post IDs to limit the deletion.

Returns: array — Deletion result.

revisions_to_keep()

Sets the number of revisions to keep for a specific post type.

Since: 3.0.0
Line: 713

public function revisions_to_keep( $num, $post ): int;
Type Name Description
int $num Number of revisions to store.
\WP_Post $post Post object.

Returns: int — Number of revisions to keep.

get_revision_post_types()

Retrieve the post types that have revisions.

Since: 3.0.0
Line: 736

public function get_revision_post_types(  ): array;

Returns: array — Array of post types that support revisisions in the format name => label/name