Skip to content

Commit

Permalink
- Adding a bit of defensive code just in case $args['capabilities']
Browse files Browse the repository at this point in the history
… type isn't what we expect.
  • Loading branch information
ramonjd committed Aug 10, 2023
1 parent ca0eee5 commit c592cc7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/compat/wordpress-6.4/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
* @return array Register post type args.
*/
function gutenberg_add_custom_capabilities_to_wp_block( $args ) {
$args['capabilities']['delete_posts'] = 'delete_posts';
if ( is_array( $args ) ) {
if ( is_array( $args['capabilities'] ) || ! isset( $args['capabilities'] ) ) {
$args['capabilities']['delete_posts'] = 'delete_posts';
}
}
return $args;
}
add_filter( 'register_wp_block_post_type_args', 'gutenberg_add_custom_capabilities_to_wp_block', 10, 1 );

0 comments on commit c592cc7

Please sign in to comment.