[wp-trac] [WordPress Trac] #64518: Interactivity API: `data-wp-bind` stops processing valid directives when encountering an invalid one
WordPress Trac
noreply at wordpress.org
Fri Jan 16 09:16:50 UTC 2026
#64518: Interactivity API: `data-wp-bind` stops processing valid directives when
encountering an invalid one
-------------------------------+--------------------
Reporter: luisherranz | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 7.0
Component: Interactivity API | Version:
Severity: normal | Keywords:
Focuses: |
-------------------------------+--------------------
When the Interactivity API is processing the `data-wp-bind` directive on
the server using the `data_wp_bind_processor` method,
[https://github.com/WordPress/wordpress-
develop/blob/bee33568389cc8dc534fc4c19f1488ded1059386/src/wp-includes
/interactivity-api/class-wp-interactivity-api.php#L1029 a `return`
statement inside a `foreach` loop] causes the function to exit entirely
when encountering a `data-wp-bind` directive with an empty suffix or a
unique ID. This prevents any subsequent valid bind directives on the same
element from being processed.
Steps to Reproduce:
1. Create an element with both an invalid `data-wp-bind` directive (no
suffix) and a valid one:
{{{
<div
data-wp-interactive="myPlugin"
data-wp-context='{"id":"some-id"}'
data-wp-bind="context.id"
data-wp-bind--id="context.id"
>
Text
</div>
}}}
2. Process the directives using `wp_interactivity_process_directives()`.
Expected Behavior:
The invalid `data-wp-bind` (no suffix) should be skipped, and the valid
`data-wp-bind--id` should be processed, resulting in:
{{{
<div
data-wp-interactive="myPlugin"
data-wp-context='{"id":"some-id"}'
data-wp-bind="context.id"
data-wp-bind--id="context.id"
id="some-id"
>
Text
</div>
}}}
Actual Behavior:
The `return` statement exits the function when it encounters the invalid
directive, so the valid `data-wp-bind--id` is never processed. The `id`
attribute is not added.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64518>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list