Recent

Commentsclass

Comments

Comments class.

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

Methods

__construct()

Constructor.

Since: 3.0.0
Line: 46

public function __construct(  );

get_effective_age()

Resolve the effective closing age for a post type.

-2 (default) inherits the global comment_age/pbtb_age setting; -1 disables closing for this post type; 0 or higher is an explicit age in days.

Since: 3.2.0
Line: 62

public function get_effective_age( string $type, string $post_type ): ?int;
Type Name Description
string $type Discussion type: comment or ping.
string $post_type Post type.

Returns: ?int — Age in days, or null when closing is disabled for this post type.

get_type_ages()

Resolve the effective closing age for each of the given post types.

Since: 3.2.0
Line: 83

public function get_type_ages( string $type, array $post_types ): array;
Type Name Description
string $type Discussion type: comment or ping.
array $post_types Post types.

Returns: array — int|null> Post type to effective age, null meaning disabled.

get_count_threshold()

Approved-comment count threshold for closing comments.

Opt-in; zero disables it. Only ordinary approved comments count: pingbacks, trackbacks, spam, unapproved entries, and internal editor notes are excluded. Scheduled checking evaluates this once per run, not atomically, so concurrent or between-run submissions can push a post’s count past the threshold before the next run closes it.

Since: 3.2.0
Line: 106

public function get_count_threshold(  ): int;

Returns: int — Threshold. Zero disables it.

get_supported_post_types()

Retrieve public post types eligible for per-post-type age overrides.

Matches the universe offered by the comment_post_types/pbtb_post_types selectors.

Since: 3.2.0
Line: 119

public function get_supported_post_types(  ): array;

Returns: array — Array of post types in the format name => label.

process_comments()

Process comments based on settings.

Since: 3.0.0
Line: 136

public function process_comments(  ): array;

Returns: array

migrate_legacy_statuses()

Migrate the legacy close status to WordPress’s canonical closed value.

Since: 3.2.0
Line: 273

public function migrate_legacy_statuses(  ): array;

Returns: array — Migration result.

edit_discussions()

Function to open/close comments or pingback/trackbacks

Since: 3.0.0
Line: 362

public function edit_discussions( $type = ..., $action = ..., $args = ... ): int|bool;
Type Name Description
string $type ‘comment’ or ‘ping’.
string $action ‘open’ or ‘close’.
string|array $args Optional arguments.

Returns: int|bool — Number of rows affected/selected for all other queries. Boolean false on error.

edit_discussions_result()

Open or close discussions and preserve partial progress on failure.

Since: 3.2.0
Line: 378

public function edit_discussions_result( $type = ..., $action = ..., $args = ... ): array;
Type Name Description
string $type ‘comment’ or ‘ping’.
string $action ‘open’ or ‘close’.
string|array $args Optional arguments.

Returns: array — Discussion operation result.

preview_discussions()

Preview a discussion operation without changing content.

Since: 3.2.0
Line: 492

public function preview_discussions( string $type, string $action, array $args = ..., int $sample_limit = ... ): array;
Type Name Description
string $type Discussion type: comment or ping.
string $action Operation: open or close.
array $args Operation arguments.
int $sample_limit Maximum sample rows.

Returns: array — Preview data.

get_preview()

Preview every configured comments operation.

Since: 3.2.0
Line: 557

public function get_preview( int $sample_limit = ... ): array;
Type Name Description
int $sample_limit Maximum sample rows per operation.

Returns: array — Preview data.

open_comments()

Open comments.

Since: 3.0.0
Line: 910

public function open_comments( $args = ... ): int|bool;
Type Name Description
array $args Array of arguments.

Returns: int|bool — Number of rows affected/selected for all other queries. Boolean false on error.

close_comments()

Close comments.

Since: 3.0.0
Line: 922

public function close_comments( $args = ... ): int|bool;
Type Name Description
array $args Array of arguments.

Returns: int|bool — Number of rows affected/selected for all other queries. Boolean false on error.

open_pingbacks()

Open pingbacks/trackbacks.

Since: 3.0.0
Line: 934

public function open_pingbacks( $args = ... ): int|bool;
Type Name Description
array $args Array of arguments.

Returns: int|bool — Number of rows affected/selected for all other queries. Boolean false on error.

close_pingbacks()

Close pingbacks/trackbacks.

Since: 3.0.0
Line: 946

public function close_pingbacks( $args = ... ): int|bool;
Type Name Description
array $args Array of arguments.

Returns: int|bool — Number of rows affected/selected for all other queries. Boolean false on error.

delete_pingbacks()

Delete pingbacks/trackbacks.

Since: 3.0.0
Line: 958

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

Returns: int|bool — Number of rows affected/selected for all other queries. Boolean false on error.

delete_pingbacks_result()

Delete pingbacks/trackbacks and preserve partial progress.

Since: 3.2.0
Line: 972

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

Returns: array — Deletion result.

preview_pingbacks()

Preview pingback/trackback deletion without changing content.

Since: 3.2.0
Line: 1041

public function preview_pingbacks( $post_ids = ..., int $sample_limit = ... ): array;
Type Name Description
array|string $post_ids Optional post IDs to limit the preview.
int $sample_limit Maximum sample rows.

Returns: array — Preview data.