Ensure compat WP 7+ : enqueue assets for shared blocks - #17
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 11c6a3c. Configure here.
|
|
||
| // When displaying full content, just return the rendered content. | ||
| if ( 'full' === $display ) { | ||
| $this->enqueue_embedded_block_assets( $block_data['html'] ); |
There was a problem hiding this comment.
Skip dependencies filter bypassed
Medium Severity
enqueue_embedded_block_assets runs before multisite_shared_block_skip_block_dependencies is applied, so assets are always enqueued even when that filter returns true. The existing dependency path still honors the filter, so behavior is now inconsistent and the documented opt-out no longer fully works.
Reviewed by Cursor Bugbot for commit 11c6a3c. Configure here.
|
|
||
| if ( ! str_contains( $html, $block_class ) ) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Unreliable HTML block detection
Medium Severity
Block presence is inferred with str_contains on generated wp-block-* class names instead of the accurate use_block_types list already returned by the renderer. Substring matches cause false positives such as wp-block-column inside wp-block-columns, and blocks without the default classname are missed, so view scripts or styles may not load.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 11c6a3c. Configure here.


Note
Medium Risk
Runs on every full shared-block render and may enqueue extra assets site-wide for matching block classes; behavior is additive to existing dependency enqueuing.
Overview
When a shared block is rendered in full display mode, the consumer page now runs
enqueue_embedded_block_assets()on the remote HTML before the existing dependency logic.That helper walks all registered block types, detects which appear in the markup via their
wp-block-*class names, and enqueuesstyle_handles,view_script_handles, andview_script_module_ids—covering front-end styles and interactivity assets that the olderuse_block_typespath only partially addressed via legacyscript/stylehandles.Reviewed by Cursor Bugbot for commit 11c6a3c. Bugbot is set up for automated code reviews on this repo. Configure here.