Changeset 60946
- Timestamp:
- 10/16/2025 06:54:54 PM (5 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
-
src/wp-includes/block-bindings/post-data.php (modified) (2 diffs)
-
src/wp-includes/block-bindings/term-data.php (added)
-
src/wp-settings.php (modified) (1 diff)
-
tests/phpunit/includes/functions.php (modified) (1 diff)
-
tests/phpunit/tests/block-bindings/register.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-bindings/post-data.php
r60778 r60946 24 24 } 25 25 26 if ( empty( $block_instance->context['postId'] ) ) { 26 /* 27 * BACKWARDS COMPATIBILITY: Hardcoded exception for navigation blocks. 28 * Required for WordPress 6.9+ navigation blocks. DO NOT REMOVE. 29 */ 30 $block_name = $block_instance->name ?? ''; 31 $is_navigation_block = in_array( 32 $block_name, 33 array( 'core/navigation-link', 'core/navigation-submenu' ), 34 true 35 ); 36 37 if ( $is_navigation_block ) { 38 // Navigation blocks: read from block attributes. 39 $post_id = $block_instance->attributes['id'] ?? null; 40 } else { 41 // All other blocks: use context. 42 $post_id = $block_instance->context['postId'] ?? null; 43 } 44 45 // If we don't have an entity ID, bail early. 46 if ( empty( $post_id ) ) { 27 47 return null; 28 48 } 29 $post_id = $block_instance->context['postId'];30 49 31 50 // If a post isn't public, we need to prevent unauthorized users from accessing the post data. … … 46 65 return ''; 47 66 } 67 } 68 69 if ( 'link' === $source_args['key'] ) { 70 $permalink = get_permalink( $post_id ); 71 return false === $permalink ? null : esc_url( $permalink ); 48 72 } 49 73 } -
trunk/src/wp-settings.php
r60939 r60946 370 370 require ABSPATH . WPINC . '/block-bindings/post-data.php'; 371 371 require ABSPATH . WPINC . '/block-bindings/post-meta.php'; 372 require ABSPATH . WPINC . '/block-bindings/term-data.php'; 372 373 require ABSPATH . WPINC . '/blocks.php'; 373 374 require ABSPATH . WPINC . '/blocks/index.php'; -
trunk/tests/phpunit/includes/functions.php
r60539 r60946 351 351 remove_action( 'init', '_register_block_bindings_post_data_source' ); 352 352 remove_action( 'init', '_register_block_bindings_post_meta_source' ); 353 remove_action( 'init', '_register_block_bindings_term_data_source' ); 353 354 } 354 355 tests_add_filter( 'init', '_unhook_block_registration', 1000 ); -
trunk/tests/phpunit/tests/block-bindings/register.php
r60539 r60946 76 76 'core/post-meta' => get_block_bindings_source( 'core/post-meta' ), 77 77 'core/pattern-overrides' => get_block_bindings_source( 'core/pattern-overrides' ), 78 'core/term-data' => get_block_bindings_source( 'core/term-data' ), 78 79 ); 79 80
Note: See TracChangeset
for help on using the changeset viewer.