I did this to show how easy it is to create your own media inserter. In production I would create a a server that returns the json.
- Create a block
- in
wp-content/plugins
runnpx @wordpress/create-block@latest my-image-inserter
cd my-image-inserter
- in
- Copy index.js to
my-image-inserter/src/index.js
- Delete
my-image-inserter/my-image-inserter.php
- Copy plugin.php to
my-image-inserter/plugin.php
- Copy images.json to
my-image-inserter/images.json
- Run
npm run build
- Activate the plugin
Documentation, see registerInserterMediaCategory
Images are from https://picsum.photos/
Test the search by entering the number 1
or 2
or 3
... It's a partial match search on the title field.
This plugin is copyright © 2024 Per Soderlind.
This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.