-
Notifications
You must be signed in to change notification settings - Fork 34
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
PLANET-5460 Disable Wordpress(wp5.5) Blocks Directory feature #1221
Conversation
63c9151
to
c1d9e45
Compare
c1d9e45
to
cda65e9
Compare
src/MasterSite.php
Outdated
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' ); | ||
remove_action( 'enqueue_block_editor_assets', 'gutenberg_enqueue_block_editor_assets_block_directory' ); | ||
} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I can't make the block directory work for some reason (it makes an OPTION request to its endpoint when I type in the box and that's all, no search after that); but I can see the script block-directory.js
still loaded in the network tab.
From what I've read and tested, you don't need a hook to remove an action from a theme, and I can't see where the gutenberg_enqueue_block_editor_assets_block_directory
is used, I can only assume it is specific to the Gutenberg repo and transformed at some point, but not included in the Wordpress install. In the end using only this one (without add_action()
) seems to work:
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
Which version are you on ? I just installed 5.5.3 so maybe we are on a different one (5.5.2 was just a few days before)
edit: We could also disable the endpoint, something like
protected function hooks() {
// ...
$this->disable_block_directory();
}
public function disable_block_directory() {
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
add_filter( 'rest_endpoints', [ $this, 'disable_block_directory_endpoint'] );
}
public function disable_block_directory_endpoint( $endpoints ) {
unset( $endpoints['/wp/v2/block-directory/search'] );
return $endpoints;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @lithrel - Thanks for the review :) . I am using the same WPv5.5.3 version. Could you try commenting the define('DISALLOW_FILE_MODS', true );
line in wp-config.php
file.
I updated the PR with above changes. please have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try commenting the
define('DISALLOW_FILE_MODS', true );
line inwp-config.php
file.
That was it, thanks !
cda65e9
to
16e8dc1
Compare
16e8dc1
to
cb1c468
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
JIRA 5460
The branch is pin on planet-test-nix test instance for testing.