Reopen
Reopen class.
When a published post is saved/updated, reopens comments for a configured
number of days by writing a Unix timestamp to _acc_reopen_until post meta.
The cron closing query in Comments::edit_discussions() respects this window
and will not close the post until the window expires.
Namespace: WebberZone\AutoClose\Features
Since: 3.1.0
Source: includes/features/class-reopen.php line 28
Methods
__construct()
Constructor.
Since: 3.1.0
Line: 49
public function __construct( );
without_reopening() static
Run a callback without allowing the resulting post update to reopen comments.
Since: 3.2.0
Line: 62
static public function without_reopening( callable $callback ): void;
| Type | Name | Description |
|---|---|---|
callable |
$callback |
Callback to invoke. |
Returns: void
capture_before_update()
Capture the state immediately before an existing post is updated.
Since: 3.2.0
Line: 81
public function capture_before_update( $post_id, $post_after, $post_before ): void;
| Type | Name | Description |
|---|---|---|
int |
$post_id |
Post ID. |
\WP_Post |
$post_after |
Post object after the update. Unused. |
\WP_Post |
$post_before |
Post object before the update. |
Returns: void
reopen_on_update()
Reopen comments when a published post is saved.
Since: 3.1.0
Line: 102
public function reopen_on_update( $post_id, $post, $update = ... ): void;
| Type | Name | Description |
|---|---|---|
int |
$post_id |
Post ID. |
\WP_Post |
$post |
Post object. |
bool |
$update |
Whether this is an existing post being updated. |
Returns: void
restore_after_revision()
Restore the pre-update comment state after a revision is restored.
Restoring a revision uses wp_update_post() internally and therefore fires save_post before the wp_restore_post_revision action. Reapply the state that existed before that update so a closed post is not reopened silently.
Since: 3.2.0
Line: 160
public function restore_after_revision( $post_id, $revision_id ): void;
| Type | Name | Description |
|---|---|---|
int |
$post_id |
Restored post ID. |
int |
$revision_id |
Restored revision ID. Unused. |
Returns: void