WordPress 5.5 added the Block Directory — a curated repository of single-block plugins that editors can search and install directly from the block inserter without ever leaving the editor screen. When an editor types a block name in the inserter’s search field and no installed block matches, WordPress automatically queries the Block Directory API and shows matching third-party blocks alongside a one-click Install button. The block is downloaded, activated as a plugin, and inserted into the post in one step. For developers, this means single-block plugins published on WordPress.org can reach editors who would never navigate to the Plugins screen. For site administrators who need tighter control, the feature can be disabled entirely. Understanding both sides — how it works and how to restrict it — is useful for any developer managing client sites on WordPress 5.5 or later.
Problem: You manage a client site on WordPress 5.5 and want to disable the Block Directory to prevent editors from installing arbitrary plugins directly from the block inserter, while still allowing them to use all currently installed blocks.
Solution: Remove the Block Directory feature with remove_action() on the enqueue_block_editor_assets hook. To disable it network-wide on multisite, use a must-use plugin. To check whether a block is installed programmatically, use WP_Block_Type_Registry.
<?php
// ── Disable the Block Directory completely ─────────────────────────────
// This removes the "Install block" button and API queries from the inserter.
add_action( 'init', function () {
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
} );
// ── Check programmatically whether a specific block type is registered ─
function is_block_registered( $block_name ) {
return WP_Block_Type_Registry::get_instance()->is_registered( $block_name );
}
// Examples:
var_dump( is_block_registered( 'core/paragraph' ) ); // true
var_dump( is_block_registered( 'my-plugin/callout' ) ); // false if not installed
// ── List all registered block types ────────────────────────────────────
$all_blocks = WP_Block_Type_Registry::get_instance()->get_all_registered();
foreach ( array_keys( $all_blocks ) as $name ) {
echo $name . "
"; // e.g. core/paragraph, core/heading, my-plugin/...
}
If you want to allow the Block Directory but restrict which blocks can be searched, use the block_editor_settings_all filter to modify the editor config:
<?php
// Disable Block Directory only for non-administrators
add_filter( 'block_editor_settings_all', function ( $settings ) {
if ( ! current_user_can( 'install_plugins' ) ) {
$settings['__experimentalBlockDirectory'] = false;
}
return $settings;
} );
NOTE: The Block Directory only installs single-block plugins — plugins that contain exactly one block and meet WordPress.org's Block Directory submission requirements. Standard multi-block plugins do not appear in the Block Directory search. Installing a block via the Block Directory creates a full plugin entry in the Plugins screen, so administrators can review and remove it at any time. The feature respects the install_plugins capability — users without that capability see the Block Directory results but cannot install them.