Skip to content

Commit

Permalink
Fix unset array key warning in block-bindings.php (WordPress#66337)
Browse files Browse the repository at this point in the history
* Fix unset array key warning in block-bindings.php

This has been throwing an error for several weeks on one of my sites

Simplest fix is to just bail early if it's unset

PHP Warning:  Undefined array key "show_in_rest" in /var/www/wp-content/plugins/gutenberg/lib/compat/wordpress-6.7/block-bindings.php on line 70

* Update block-bindings.php

Co-authored-by: benharri <[email protected]>
Co-authored-by: SantosGuillamot <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
4 people authored Nov 1, 2024
1 parent 33c3bb7 commit d2157ff
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/compat/wordpress-6.7/block-bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ function gutenberg_update_meta_args_with_label( $args ) {
return $args;
}

// Don't update schema if not exposed to REST
if ( ! isset( $args['show_in_rest'] ) ) {
return $args;
}

$schema = array( 'title' => $args['label'] );
if ( ! is_array( $args['show_in_rest'] ) ) {
$args['show_in_rest'] = array(
Expand Down

0 comments on commit d2157ff

Please sign in to comment.