[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
Mon Mar 16 11:24:01 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                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+---------------------
Changes (by ozgursar):

 * keywords:  has-patch has-unit-tests needs-testing => has-patch has-unit-
     tests


Comment:

 == Patch Testing Report

 Patch Tested: https://github.com/WordPress/wordpress-develop/pull/10746

 === Environment
 - WordPress: 7.0-beta5-61991-src
 - PHP: 8.2.29
 - Server: nginx/1.29.4
 - Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
 - Browser: Chrome 145.0.0.0
 - OS: macOS
 - Theme: Twenty Twenty-Five 1.4
 - MU Plugins: None activated
 - Plugins:
   * Code Snippets 3.9.5
   * Test Reports 1.2.1

 === Steps taken
 1. Add the following to functions.php to create a shortcode that
 reproduces the bug:

 {{{
 add_shortcode('bug_test', function() {
     wp_interactivity_state( 'myPlugin', [
         'id' => 'some-id',
     ]);

     $html = '<div
         data-wp-bind="myPlugin::state.id"
         data-wp-bind--id="myPlugin::state.id"
     >
         Text
     </div>';

     return wp_interactivity_process_directives( $html );
 });
 }}}

 2. Add the `[bug_test]` shortcode to any post and observe the generated
 HTML source code
 3. Without the patch, the outer <div> is missing the `id="some-id"`
 attribute entirely,
    confirming the bug (the return statement exits `data_wp_bind_processor`
 ''before''
    processing the valid `data-wp-bind--id` directive)
 4. Apply the patch
 5. Reload the page and view page source again. `id="some-id"` now appears
 on the `<div>`,
    confirming the valid directive is processed correctly.
 6. ✅ Patch is solving the problem

 === Screenshots/Screencast with results
 Before
 [[Image(https://i.imgur.com/RO4k5wN.png)]]

 After
 [[Image(https://i.imgur.com/iKCPgRR.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64518#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list