Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patterns: add delete_posts to the wp_block (patterns) capabilities #53405

Merged
merged 3 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib/compat/wordpress-6.4/blocks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* Temporary compatibility shims for block APIs present in Gutenberg.
*
* @package gutenberg
*/

/**
* Adds delete_posts capabilities to the wp_block post type.
*
* @param array $args Register post type args.
*
* @return array Register post type args.
*/
function gutenberg_add_custom_capabilities_to_wp_block( $args ) {
if ( is_array( $args ) ) {
if ( ! isset( $args['capabilities'] ) || is_array( $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 );
3 changes: 3 additions & 0 deletions lib/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ function gutenberg_is_experiment_enabled( $name ) {
require __DIR__ . '/compat/wordpress-6.3/block-editor-settings.php';
require_once __DIR__ . '/compat/wordpress-6.3/kses.php';

// WordPress 6.4 compat.
require __DIR__ . '/compat/wordpress-6.4/blocks.php';

// Experimental features.
require __DIR__ . '/experimental/block-editor-settings-mobile.php';
require __DIR__ . '/experimental/blocks.php';
Expand Down
Loading