@@ -23,10 +23,29 @@ function _block_bindings_post_data_get_value( array $source_args, $block_instanc
2323 return null ;
2424 }
2525
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 ) ) {
2747 return null ;
2848 }
29- $ post_id = $ block_instance ->context ['postId ' ];
3049
3150 // If a post isn't public, we need to prevent unauthorized users from accessing the post data.
3251 $ post = get_post ( $ post_id );
@@ -46,6 +65,11 @@ function _block_bindings_post_data_get_value( array $source_args, $block_instanc
4665 return '' ;
4766 }
4867 }
68+
69+ if ( 'link ' === $ source_args ['key ' ] ) {
70+ $ permalink = get_permalink ( $ post_id );
71+ return false === $ permalink ? null : esc_url ( $ permalink );
72+ }
4973}
5074
5175/**
0 commit comments