Sync_Manager
Sync Manager class.
Namespace: WebberZone\Better_Search\Pro\Custom_Tables
Since: 4.2.0
Source: includes/custom-tables/class-sync-manager.php line 23
Methods
__construct()
Constructor.
Since: 4.2.0
Line: 41
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: 63
public function handle_save_post( $post_id, $post ): void;
| Type | Name | Description |
|---|---|---|
int | $post_id | Post ID. |
\WP_Post | $post | Post object. |
Returns: void
handle_delete_post()
Handle delete post action.
Since: 4.2.0
Line: 76
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: 90
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: 137
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: 198
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: 279
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: 319
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: 360
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: 406
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: 502
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: 525
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: 561
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: 620
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: 681
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: 710
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