Environment
-
Tool: Claude Code (MCP client), via MCP Adapter
-
OS: Windows 11
-
Browser: Chrome (only relevant for step 2, setting the lightbox in the builder)
-
URL: staging site, access can be provided on request
| Component | Version |
|---|---|
| Bricks | 2.4-beta2 |
| Bricks child theme | 1.1 |
| Bricks abilities contract | 1.0.0 |
| WordPress MCP Adapter | 0.5.0 |
| WordPress | 7.0.2 |
| PHP | 8.1.34 (fpm-fcgi) |
| MySQL | 8.0.36 |
| Memory limit | 256M |
| Bricks CSS loading | inline |
Abilities API and MCP adapter both active and working; all other abilities behave as expected.
Description
For the image and image-gallery elements, link is a select control with the valid options lightbox, attachment, media and custom. The abilities validator, however, treats link as a link-object control for every element type and rejects any string value:
Element 'v0a0f4' has a `link` setting that is not an object.
Bricks expects `link` to be an object like { type: 'external', url: 'https://example.com' }.
Two consequences:
-
Lightboxes cannot be set through the API at all.
-
More importantly: once a lightbox has been set in the builder, every subsequent write to that page fails, including updates to completely unrelated elements. The validator walks the whole element tree on write and trips over the existing, perfectly valid
link: "lightbox".
So a normal builder setting renders the page uneditable through the API.
Steps to reproduce
-
Add an
imageorimage-galleryelement to a page. -
In the builder, set Link to → Lightbox. Save.
-
Call
bricks/update-elementon any element of that page, for example changing a heading’s text. -
The call fails with the error above, naming the image element rather than the one being updated.
Setting link: "lightbox" directly via bricks/update-element fails the same way, so there is no API-side workaround.
Expected
link should be validated per element type: as an object where the control is of type link, and as a select value where the control is a select (image, image-gallery). A pre-existing valid value should never block writes to other elements.
Impact
Any page using a lightbox is locked out of the abilities API. Since lightboxes are common on gallery pages, this affects a lot of real sites. Current workaround is to remove the lightbox, write, then set it again, or to patch the database directly.
Possibly related: the pattern resembles 39777 (global class _cssCustom cleared when the class is inspected in the builder): in both cases a valid state that one layer cannot represent gets rejected or destroyed by that layer.