Recent

Sync_ManagerclassPro only

Sync_Manager

Sync Manager class.

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

Methods

__construct()

Constructor.

Since: 4.0.0
Line: 49

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.0.0
Line: 75

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.1
Line: 97

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.1
Line: 110

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, without reacting to cache metadata writes.

Since: 4.4.1
Line: 126

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.1
Line: 147

public function flush_pending_sync(  ): void;

Returns: void

handle_delete_post()

Handle delete post action.

Since: 4.0.0
Line: 186

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.2.3
Line: 204

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.0.0
Line: 251

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.0
Line: 313

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.0.0
Line: 396

public function prepare_post_content( $post, $rendered_content = ... ): string;
Type Name Description
\WP_Post $post Post object.
string|null $rendered_content Optional. Content already put through render_post_content().

Returns: string — Processed content.

trim_content()

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

Since: 4.0.0
Line: 471

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.0.0
Line: 513

public function prepare_post_excerpt( $post, $rendered_content = ... ): string;
Type Name Description
\WP_Post $post Post object.
string|null $rendered_content Optional. Content already put through render_post_content().

Returns: string — Processed excerpt.

prepare_product_content()

Prepare WooCommerce product content for storage.

Since: 4.2.0
Line: 557

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

Returns: string — Processed product content.

prepare_product_excerpt()

Prepare WooCommerce product excerpt.

Since: 4.2.0
Line: 653

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

Returns: string — Processed product excerpt.

refresh_terms_only()

Refresh only taxonomy JSON and tax_score for a post.

Since: 4.1.0
Line: 676

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.0.0
Line: 712

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.0.0
Line: 773

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.0.0
Line: 834

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.1.0
Line: 863

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.1
Line: 883

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