Recent

Sync_Manager class Pro only

Sync_Manager

Sync Manager class.

Namespace: WebberZone\Contextual_Related_Posts\Pro\Custom_Tables
Since: 4.0.0
Source: includes/custom-tables/class-sync-manager.php line 23

Methods

__construct()

Constructor.

Since: 4.0.0
Line: 41

public function __construct( Table_Manager $table_manager );
TypeNameDescription
Table_Manager$table_managerInstance of the Table Manager.

handle_save_post()

Handle save post action.

Since: 4.0.0
Line: 58

public function handle_save_post( $post_id, $post ): void;
TypeNameDescription
int$post_idPost ID.
\WP_Post$postPost object.

Returns: void

handle_delete_post()

Handle delete post action.

Since: 4.0.0
Line: 71

public function handle_delete_post( $post_id ): void;
TypeNameDescription
int$post_idPost ID.

Returns: void

reconcile_missing_posts()

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

Since: 4.2.3
Line: 85

public function reconcile_missing_posts( int $blog_id = ..., int $limit = ... ): int;
TypeNameDescription
int$blog_idBlog ID. Default 0 (current site).
int$limitMaximum posts to sync per run. Default 100.

Returns: int — Number of posts synced.

sync_post()

Sync post content to custom tables.

Since: 4.0.0
Line: 132

public function sync_post( $post_id, $post, $blog_id = ... ): void;
TypeNameDescription
int$post_idPost ID.
\WP_Post$postPost object.
int$blog_idBlog ID.

Returns: void

sync_product()

Sync WooCommerce product content to custom tables.

Since: 4.2.0
Line: 193

public function sync_product( $post_id, $post, $blog_id = ... ): void;
TypeNameDescription
int$post_idProduct ID.
\WP_Post$postPost object.
int$blog_idBlog ID.

Returns: void

prepare_post_content()

Prepare post content for storage.

Since: 4.0.0
Line: 275

public function prepare_post_content( $post ): string;
TypeNameDescription
\WP_Post$postPost object.

Returns: string — Processed content.

trim_content()

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

Since: 4.0.0
Line: 315

public function trim_content( $content, $limit = ... ): string;
TypeNameDescription
string$contentPost content.
int$limitCharacter limit.

Returns: string — Trimmed content.

prepare_post_excerpt()

Prepare post excerpt.

Since: 4.0.0
Line: 356

public function prepare_post_excerpt( $post ): string;
TypeNameDescription
\WP_Post$postPost object.

Returns: string — Processed excerpt.

prepare_product_content()

Prepare WooCommerce product content for storage.

Since: 4.2.0
Line: 402

public function prepare_product_content( $product ): string;
TypeNameDescription
\WC_Product$productProduct object.

Returns: string — Processed product content.

prepare_product_excerpt()

Prepare WooCommerce product excerpt.

Since: 4.2.0
Line: 498

public function prepare_product_excerpt( $product ): string;
TypeNameDescription
\WC_Product$productProduct object.

Returns: string — Processed product excerpt.

refresh_terms_only()

Refresh only taxonomy JSON and tax_score for a post.

Since: 4.1.0
Line: 521

public function refresh_terms_only( int $post_id ): void;
TypeNameDescription
int$post_idPost ID.

Returns: void

prepare_post_terms()

Prepare post terms data.

Since: 4.0.0
Line: 557

public function prepare_post_terms( WP_Post $post ): string;
TypeNameDescription
\WP_Post$postPost object.

Returns: string — JSON encoded terms data.

prepare_tax_score()

Calculate taxonomy score for a post.

Since: 4.0.0
Line: 616

public function prepare_tax_score( WP_Post $post, string $terms_json ): float;
TypeNameDescription
\WP_Post$postPost object.
string$terms_jsonJSON encoded terms data.

Returns: float — Calculated taxonomy score.

delete_post()

Delete post data from custom tables.

Since: 4.0.0
Line: 677

public function delete_post( $post_id, $blog_id = ... ): void;
TypeNameDescription
int$post_idPost ID.
int$blog_idBlog ID.

Returns: void

handle_edited_term()

Handle edited_term action to keep term names in sync.

Since: 4.1.0
Line: 706

public function handle_edited_term( int $term_id, int $tt_id, string $taxonomy ): void;
TypeNameDescription
int$term_idTerm ID.
int$tt_idTerm taxonomy ID.
string$taxonomyTaxonomy slug.

Returns: void