Skip to content

Commit 3b103b2

Browse files
committed
Use new block-agnostic filter
1 parent 91ca74b commit 3b103b2

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

lib/compat/wordpress-6.9/block-bindings.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,20 @@
88
*/
99

1010

11-
// The following filters can be removed once the minimum required WordPress version is 6.9 or newer.
11+
// The following filter can be removed once the minimum required WordPress version is 6.9 or newer.
1212
add_filter(
13-
'block_bindings_supported_attributes_core/image',
14-
function ( $attributes ) {
15-
if ( ! in_array( 'caption', $attributes, true ) ) {
13+
'block_bindings_supported_attributes',
14+
function ( $attributes, $block_type ) {
15+
if ( 'core/image' === $block_type && ! in_array( 'caption', $attributes, true ) ) {
1616
$attributes[] = 'caption';
1717
}
18-
return $attributes;
19-
},
20-
10,
21-
3
22-
);
23-
24-
add_filter(
25-
'block_bindings_supported_attributes_core/post-date',
26-
function ( $attributes ) {
27-
if ( ! in_array( 'datetime', $attributes, true ) ) {
18+
if ( 'core/post-date' === $block_type && ! in_array( 'datetime', $attributes, true ) ) {
2819
$attributes[] = 'datetime';
2920
}
3021
return $attributes;
3122
},
3223
10,
33-
3
24+
2
3425
);
3526

3627
/**

0 commit comments

Comments
 (0)