Recent

Sync_ManagerclassPro only

Sync_Manager

Sync Manager class.

Namespace: WebberZone\Better_Search\Pro\Custom_Tables
Since: 4.2.0
Source: includes/pro/custom-tables/class-sync-manager.php line 24

Methods

__construct()

Constructor.

Since: 4.2.0
Line: 50

public function __construct( Table_Manager $table_manager );
Type Name Description
Table_Manager $table_manager Instance of the Table Manager.

handle_save_post()

Handle save post action.

Since: 4.2.0
Line: 85

public function handle_save_post( $post_id, $post, $update = ..., $post_before = ... ): void;
Type Name Description
int $post_id Post ID.
\WP_Post $post Post object.
bool $update Whether this is an update.
\WP_Post|null $post_before Previous post object.

Returns: void

handle_set_object_terms()

Queue taxonomy changes made independently of a post save.

Since: 4.4.3
Line: 107

public function handle_set_object_terms( $object_id, $terms, $tt_ids, $taxonomy ): void;
Type Name Description
int $object_id Post ID.
array|string $terms Assigned terms.
array $tt_ids Term taxonomy IDs.
string $taxonomy Taxonomy name.

Returns: void

handle_deleted_term_relationships()

Queue taxonomy relationship removals, including deleted terms.

Since: 4.4.3
Line: 120

public function handle_deleted_term_relationships( $object_id, $tt_ids, $taxonomy ): void;
Type Name Description
int $object_id Post ID.
array $tt_ids Term taxonomy IDs.
string $taxonomy Taxonomy name.

Returns: void

handle_meta_change()

Queue indexed metadata changes.

Since: 4.4.3
Line: 136

public function handle_meta_change( $meta_id, $post_id, $meta_key ): void;
Type Name Description
int|array $meta_id Metadata ID or IDs.
int $post_id Post ID.
string $meta_key Metadata key.

Returns: void

flush_pending_sync()

Coalesce independent term/meta edits and preserve multisite context.

Since: 4.4.3
Line: 157

public function flush_pending_sync(  ): void;

Returns: void

handle_delete_post()

Handle delete post action.

Since: 4.2.0
Line: 196

public function handle_delete_post( $post_id ): void;
Type Name Description
int $post_id Post ID.

Returns: void

reconcile_missing_posts()

Sync any published posts that are missing from the custom table.

Since: 4.3.0
Line: 210

public function reconcile_missing_posts( int $blog_id = ..., int $limit = ... ): int;
Type Name Description
int $blog_id Blog ID. Default 0 (current site).
int $limit Maximum posts to sync per run. Default 100.

Returns: int — Number of posts synced.

sync_post()

Sync post content to custom tables.

Since: 4.2.0
Line: 257

public function sync_post( $post_id, $post, $blog_id = ... ): void;
Type Name Description
int $post_id Post ID.
\WP_Post $post Post object.
int $blog_id Blog ID.

Returns: void

sync_product()

Sync WooCommerce product content to custom tables.

Since: 4.2.3
Line: 321

public function sync_product( $post_id, $post, $blog_id = ... ): void;
Type Name Description
int $post_id Product ID.
\WP_Post $post Post object.
int $blog_id Blog ID.

Returns: void

get_recency_backfill_state()

Get the stored progress of the post_date_gmt backfill.

Since: 4.5.0
Line: 396

public function get_recency_backfill_state(  ): array;

Returns: array — Backfill progress.

count_indexed_rows()

Count rows in the shared content index.

Since: 4.5.0
Line: 414

public function count_indexed_rows(  ): int;

Returns: int — Row count.

reset_recency_backfill()

Reset the post_date_gmt backfill so it runs again from the start.

Since: 4.5.0
Line: 431

public function reset_recency_backfill(  ): void;

Returns: void

backfill_post_date_gmt()

Populate post_date_gmt for index rows written before the column existed.

Walks the index by content_id rather than by “still NULL”, so rows that legitimately have no usable date (deleted posts, zero dates) cannot stall the run. Row-level NULL stays a permanent “no boost” signal, not backfill scaffolding.

Since: 4.5.0
Line: 448

public function backfill_post_date_gmt( int $batch_size = ... ): array;
Type Name Description
int $batch_size Rows to process per batch.

Returns: array — Progress after this batch.

prepare_post_date_gmt()

Resolve a post’s UTC publish date for the index.

Returns null when no usable date exists, so the column is written as SQL NULL and the row stops being boosted rather than keeping a date it no longer has.

Since: 4.5.0
Line: 555

public function prepare_post_date_gmt( $post ): ?string;
Type Name Description
\WP_Post $post Post object.

Returns: ?string — UTC datetime, or null when unusable.

prepare_post_content()

Prepare post content for storage.

Since: 4.2.0
Line: 610

public function prepare_post_content( $post ): string;
Type Name Description
\WP_Post $post Post object.

Returns: string — Processed content.

trim_content()

Trims content to a set character limit without breaking the last word.

Since: 4.2.0
Line: 666

public function trim_content( $content, $limit = ... ): string;
Type Name Description
string $content Post content.
int $limit Character limit.

Returns: string — Trimmed content.

prepare_post_excerpt()

Prepare post excerpt.

Since: 4.2.0
Line: 707

public function prepare_post_excerpt( $post ): string;
Type Name Description
\WP_Post $post Post object.

Returns: string — Processed excerpt.

prepare_product_content()

Prepare WooCommerce product content for storage.

Since: 4.2.3
Line: 753

public function prepare_product_content( $product ): string;
Type Name Description
object $product Product object.

Returns: string — Processed product content.

prepare_product_excerpt()

Prepare WooCommerce product excerpt.

Since: 4.2.3
Line: 849

public function prepare_product_excerpt( $product ): string;
Type Name Description
object $product Product object.

Returns: string — Processed product excerpt.

refresh_terms_only()

Refresh only taxonomy JSON and tax_score for a post.

Since: 4.2.0
Line: 872

public function refresh_terms_only( int $post_id ): void;
Type Name Description
int $post_id Post ID.

Returns: void

prepare_post_terms()

Prepare post terms data.

Since: 4.2.0
Line: 908

public function prepare_post_terms( WP_Post $post ): string;
Type Name Description
\WP_Post $post Post object.

Returns: string — JSON encoded terms data.

prepare_tax_score()

Calculate taxonomy score for a post.

Since: 4.2.0
Line: 981

public function prepare_tax_score( WP_Post $post, string $terms_json ): float;
Type Name Description
\WP_Post $post Post object.
string $terms_json JSON encoded terms data.

Returns: float — Calculated taxonomy score.

delete_post()

Delete post data from custom tables.

Since: 4.2.0
Line: 1042

public function delete_post( $post_id, $blog_id = ... ): void;
Type Name Description
int $post_id Post ID.
int $blog_id Blog ID.

Returns: void

handle_edited_term()

Handle edited_term action to keep term names in sync.

Since: 4.2.0
Line: 1071

public function handle_edited_term( int $term_id, int $tt_id, string $taxonomy ): void;
Type Name Description
int $term_id Term ID.
int $tt_id Term taxonomy ID.
string $taxonomy Taxonomy slug.

Returns: void

process_term_batch()

Refresh one bounded batch, persisting the next ID cursor in WP-Cron.

Since: 4.4.3
Line: 1091

public function process_term_batch( int $tt_id, string $taxonomy, int $after_id = ... ): void;
Type Name Description
int $tt_id Term taxonomy ID.
string $taxonomy Taxonomy name.
int $after_id Last processed post ID.

Returns: void