Stop the block inserter suggesting and installing blocks from WordPress.org when a search finds nothing.
add_action( 'init', function (): void {
remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
} );
Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.
When an inserter search finds no matching block, WordPress offers to install one from the plugin directory with a single click. On client sites that’s an easy way to end up with dozens of small, unvetted plugins. This snippet removes the feature.
The block directory is loaded by wp_enqueue_editor_block_directory_assets on enqueue_block_editor_assets. Removing that action means the editor never loads it, so searches simply show “No results”.
install_plugins capability never see the block directory anyway.In the editor, search the inserter for a block you don’t have, such as “countdown”. You should see no install suggestions.