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: 318

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

prepare_post_content()

Prepare post content for storage.

Since: 4.2.0
Line: 399

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: 455

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: 496

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: 542

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: 638

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: 661

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: 697

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: 770

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: 831

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: 860

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: 880

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