Interactivity API: Increase hook priority for processing directives.

Use a priority of 100 to ensure that other filters can add additional directives before the processing starts.
This way, directives will be processed even if the $parsed_block variable is edited by a filter.

Reviewed by gziolo.
Merges [57826] to the to the 6.5 branch.

Props cbravobernal, swissspidy, flixos90, joemcgill, gziolo.
Fixes #60743.
Built from https://develop.svn.wordpress.org/branches/6.5@57830


git-svn-id: http://core.svn.wordpress.org/branches/6.5@57331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler 2024-03-14 08:59:13 +00:00
parent 22ceb67be0
commit 4958667689
2 changed files with 8 additions and 4 deletions

View File

@ -57,16 +57,20 @@ function wp_interactivity_process_directives_of_interactive_blocks( array $parse
}; };
/* /*
* Uses a priority of 20 to ensure that other filters can add additional * Uses a priority of 100 to ensure that other filters can add additional
* directives before the processing starts. * directives before the processing starts.
*/ */
add_filter( 'render_block_' . $block_name, $process_interactive_blocks, 20, 2 ); add_filter( 'render_block_' . $block_name, $process_interactive_blocks, 100, 2 );
} }
} }
return $parsed_block; return $parsed_block;
} }
add_filter( 'render_block_data', 'wp_interactivity_process_directives_of_interactive_blocks' ); /*
* Uses a priority of 100 to ensure that other filters can add additional attributes to
* $parsed_block before the processing starts.
*/
add_filter( 'render_block_data', 'wp_interactivity_process_directives_of_interactive_blocks', 100, 1 );
/** /**
* Retrieves the main WP_Interactivity_API instance. * Retrieves the main WP_Interactivity_API instance.

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-RC2-57828'; $wp_version = '6.5-RC2-57830';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.