Changeset 60955
- Timestamp:
- 10/17/2025 03:05:55 PM (5 weeks ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-bindings/post-data.php
r60946 r60955 15 15 * 16 16 * @param array $source_args Array containing arguments used to look up the source value. 17 * Example: array( " key" => "foo" ).17 * Example: array( "field" => "foo" ). 18 18 * @param WP_Block $block_instance The block instance. 19 19 * @return mixed The value computed for the source. 20 20 */ 21 21 function _block_bindings_post_data_get_value( array $source_args, $block_instance ) { 22 if ( empty( $source_args['key'] ) ) { 23 return null; 22 if ( empty( $source_args['field'] ) ) { 23 // Backward compatibility for when the source argument was called `key` in Gutenberg plugin. 24 if ( empty( $source_args['key'] ) ) { 25 return null; 26 } 27 $field = $source_args['key']; 28 } else { 29 $field = $source_args['field']; 24 30 } 25 31 … … 54 60 } 55 61 56 if ( 'date' === $ source_args['key']) {62 if ( 'date' === $field ) { 57 63 return esc_attr( get_the_date( 'c', $post_id ) ); 58 64 } 59 65 60 if ( 'modified' === $ source_args['key']) {66 if ( 'modified' === $field ) { 61 67 // Only return the modified date if it is later than the publishing date. 62 68 if ( get_the_modified_date( 'U', $post_id ) > get_the_date( 'U', $post_id ) ) {
Note: See TracChangeset for help on using the changeset viewer.