Block Editor PHP Beginner

Remove the Openverse Tab From the Media Inserter

Hide the Openverse library of free images from the block inserter's Media tab, so editors only use your own media.

Tested on WordPress 7.1 PHP 8.3 No plugin needed Updated
functions.php 4 lines
add_filter( 'block_editor_settings_all', function ( array $settings ): array {
	$settings['enableOpenverseMediaCategory'] = false;
	return $settings;
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

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.

The inserter’s Media tab includes Openverse, a library of openly licensed images from around the web. It’s handy, but on business sites people can insert images without checking the licence or credit requirements. This snippet removes it.

How it works

block_editor_settings_all returns the settings the editor starts with. Setting enableOpenverseMediaCategory to false removes the Openverse category from the Media tab. Your own Media Library stays.

Things to watch

  • Openverse images often require attribution. If you keep the tab, make sure editors add credits.

How to test it

Open the inserter and click Media. Openverse should no longer be listed.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only