Product_Section_Selector
Handles product-aware section selection inside the block editor.
Editor meta is the source of truth. Taxonomy assignments are derived during save operations (REST or classic). Direct term edits performed elsewhere are reconciled the next time the post is saved; implement a load-time reconciliation only if that invariant stops being acceptable.
Namespace: WebberZone\Knowledge_Base\Admin
Since: 3.0.0
Source: includes/admin/class-product-section-selector.php line 26
Methods
__construct()
Constructor.
Line: 45
public function __construct( );
register_meta()
Register Gutenberg-safe post meta for storing section selections.
Line: 66
public function register_meta( );
sanitize_id_array()
Sanitize array meta values.
Line: 118
public function sanitize_id_array( $value ): array;
| Type | Name | Description |
|---|---|---|
mixed | $value | Raw value. |
Returns: array
remove_core_taxonomy_metaboxes()
Remove classic taxonomy metaboxes replaced by custom UI.
Line: 140
public function remove_core_taxonomy_metaboxes( );
register_classic_sections_metabox()
Register replacement metabox for the classic editor.
Line: 152
public function register_classic_sections_metabox( );
render_classic_sections_metabox()
Render the custom metabox contents.
Line: 172
public function render_classic_sections_metabox( WP_Post $post );
| Type | Name | Description |
|---|---|---|
\WP_Post | $post | Current post. |
enqueue_classic_assets()
Enqueue assets for the classic editor metabox.
Line: 218
public function enqueue_classic_assets( $hook );
| Type | Name | Description |
|---|---|---|
string | $hook | Current admin page. |
filter_meta_box_order()
Strip the section metabox from stored meta-box order.
Line: 271
public function filter_meta_box_order( $order ): array|string;
| Type | Name | Description |
|---|---|---|
array|string | $order | Saved order. |
Returns: array|string
enqueue_editor_assets()
Enqueue the Gutenberg panel assets.
Line: 304
public function enqueue_editor_assets( );
sync_sections_after_rest_save()
Sync taxonomy assignments after a REST save.
Line: 355
public function sync_sections_after_rest_save( WP_Post $post, WP_REST_Request $request, $creating );
| Type | Name | Description |
|---|---|---|
\WP_Post | $post | Post object. |
\WP_REST_Request | $request | Request. |
bool | $creating | Whether this is a create operation. |
maybe_sync_sections_during_save()
Ensure taxonomy stays in sync when posts are saved outside REST.
Line: 377
public function maybe_sync_sections_during_save( $post_id, $post );
| Type | Name | Description |
|---|---|---|
int | $post_id | Post ID. |
\WP_Post | $post | Post object. |
maybe_capture_classic_submission()
Capture classic editor submissions and persist meta.
Line: 428
public function maybe_capture_classic_submission( $post_id, $post );
| Type | Name | Description |
|---|---|---|
int | $post_id | Post ID. |
\WP_Post | $post | Post object. |
use_hierarchical_section_walker()
Inject Walker_Section_Checklist for the wzkb_category checklist (Quick Edit and post editor).
Line: 691
public function use_hierarchical_section_walker( array $args, $post_id ): array;
| Type | Name | Description |
|---|---|---|
array | $args | wp_terms_checklist() arguments. |
int | $post_id | Post ID (unused). |
Returns: array