KDA Media Button

Description

KDA Media Button extends the classic WordPress editor with a new button. Clicking the button opens a popup window that gives access to the site structure so you can:

  • Browse folders relative to a configured base folder.
  • Upload new images directly into the current folder.
  • Select an existing image and insert it into the post.

The plugin is fully configurable from its settings page:

  • Accessible folder — a path relative to the site root. The plugin can only browse and upload inside this folder, which keeps the rest of the filesystem protected.
  • Allowed formats — comma separated list of allowed extensions. Leaving it empty allows all common image formats (jpg, jpeg, png, gif, webp, svg, ico, bmp, tiff, tif, avif).
  • Roles — choose which roles (e.g. Administrator, Editor) can see the editor button.
  • Lightbox link class — set a custom CSS class for the image link, or leave empty to disable the class.
  • Activity log — optionally keep a log of uploads, deletions, folder creation and renames.

Working with images

When an image is selected you can fine-tune the insertion:

  • Size — insert the original (Full) or a generated Thumbnail / Medium / Large copy.
  • Alignment — None, Left, Center or Right (adds the matching WordPress align class).
  • Alt text — custom alternative text for the inserted image.
  • Link to full image — wrap the image in a link to the full-size file with a built-in lightbox.
  • Metadata — resolution (width×height) and file size are shown before insertion, with a live thumbnail preview.

You can select multiple images (multi-select) and insert them as a gallery using the [kda_media_button_gallery] shortcode:

[kda_media_button_gallery urls="https://.../a.jpg,https://.../b.jpg" size="medium" columns="3" link="none"]

File management

Inside the popup you can also manage the folder structure:

  • Create new subfolders.
  • Rename files and folders.
  • Delete files and folders (recursive).

Security

  • Folder traversal outside the configured base folder is blocked.
  • Uploaded files are validated against the allowed formats list and handled through the WordPress upload API.
  • All AJAX requests are protected with nonces and role/capability checks.

Installation

  1. Upload the kda-media-button folder to the /wp-content/plugins/ directory.
  2. Activate the plugin through the “Plugins” menu in WordPress.
  3. Go to Settings → KDA Media Button to configure the accessible folder, allowed formats and roles.
  4. Open a post in the classic editor and use the new “Insert image from folder” button.

FAQ

Does it work with the block editor (Gutenberg)?

No. Gutenberg support is currently disabled. The plugin works only with the classic editor.

Can the plugin access any folder on the server?

No. It is restricted to the folder configured on the settings page (relative to the site root). Path traversal is prevented.

Which image formats are allowed by default?

All common image formats are allowed. You can restrict them on the settings page.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“KDA Media Button” is open source software. The following people have contributed to this plugin.

Contributors

“KDA Media Button” has been translated into 1 locale. Thank you to the translators for their contributions.

Translate “KDA Media Button” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.3.3

  • Fixed plugin icon deployment to WordPress.org assets directory.
  • Improved lightbox reopening behavior.
  • Disabled columns control until multiple images are selected.
  • Added link-to-full-image option in insert modal.
  • Removed autofocus from modal close button.

1.3.2

  • Improved plugin asset deployment to WordPress.org.
  • Fixed lightbox reopening behavior after close.
  • Disabled columns control until multiple images are selected.
  • Added link-to-full-image option in the insert modal.
  • Removed autofocus from the modal close button on open.

1.3.1

  • Fixed lightbox reopening after close without page refresh.
  • Disabled columns control until multiple images are selected.
  • Added link-to-full-image checkbox in the insert modal.
  • Removed autofocus from the modal close button on open.
  • Improved modal option layout and validation.

1.3.0

  • Improvements and bug fixes for the classic editor integration.
  • Refined base folder handling and settings validation.
  • General stability and usability improvements.

1.2.24

  • Removed hardcoded default base folder path from code.
  • Saving an empty accessible folder is now rejected with an error.
  • Added centralized helper for base folder retrieval.
  • Improved uninstall routine to use shared helper.

1.2.23

  • Fixed default base folder handling when the stored option is empty.
  • The folder field now always shows a valid default path in settings.

1.2.22

  • Removed Gutenberg block support and block files from the plugin.
  • Public gallery CSS is now disabled by default.
  • Cleaned up block-related assets and metadata.

1.2.21

  • Fixed default base folder fallback in settings.
  • Ensured default path is preserved when saving the settings form.

1.2.20

  • Updated default base folder path to include leading and trailing slashes.
  • Normalized path formatting across all retrieval points.

1.2.19

  • Added Russian readme translation.
  • Fixed language support metadata for WordPress.org.
  • Updated contributor name.

1.2.18

  • Security: blocked symlink escapes in path resolution and required edit_posts/edit_pages capability for REST access.
  • Fixed size AJAX handler reading an undefined variable.
  • Refactored legacy admin-ajax handlers to reuse shared core functions.
  • Cached image metadata to speed up browsing.
  • Added result limit to recursive search.
  • Unified image/shortcode rendering with responsive srcset.
  • SVG uploads/replacements are sanitized on save.
  • Temporarily disabled Gutenberg block support.
  • Registered the block via register_block_type_from_metadata (matches block.json apiVersion: 2); activity log is no longer autoloaded.

1.2.16

  • Added Gutenberg block “Media from Folder” (kda-media-button/media).
  • Added REST API endpoints: browse, size, srcset, tree, upload, mkdir, rename, delete, clear_log, duplicate, bulk_delete, bulk_move, replace_image.
  • Added recursive folder search with subfolder checkbox.
  • Added bulk delete, bulk move, file duplicate, copy URL (single + bulk).
  • Added responsive srcset/sizes to gallery shortcode.
  • Added non-image file support (inserted as links).
  • Added WP-CLI commands: wp kda-media-button clean-cache and wp kda-media-button rebuild-cache.
  • Added replace-image overwrite endpoint.
  • Added settings page tabs: General, Permissions, Advanced, Activity log.
  • Added keyboard navigation (arrow keys + Enter) and skeleton loaders.
  • Added dark theme support (prefers-color-scheme: dark) and mobile breakpoint.

1.2.14

  • Minor fixes and usability improvements.

1.0.0

  • First version.
  • Classic editor button opening a folder browser popup.
  • Upload and select images with insertion into the post.
  • Settings page: base folder, allowed formats and role restriction.