Download the PHP package cloakwp/media-categories without Composer
On this page you can find all versions of the php package cloakwp/media-categories. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cloakwp/media-categories
More information about cloakwp/media-categories
Files in cloakwp/media-categories
Package media-categories
Short Description Core-like media categories for WordPress — PHP-configured, no settings UI.
License LGPL-3.0-only
Informations about the package media-categories
Media Categories
Core-like media categories for WordPress — PHP-configured, no settings UI, no admin notices, no premium upsells.
Organize attachments with a hierarchical Media Categories taxonomy (category_media by default). Configure everything in PHP; the only admin UI is the Media Library itself (filters, checklists, bulk assign, add-new from the attachment sidebar).
Install paths
1. Composer (must-use plugin) — recommended
Package type is wordpress-muplugin. With composer/installers configured, that installs to:
(Your project may map that path differently — e.g. Bedrock uses public/app/mu-plugins/.)
Important: WordPress core only auto-loads PHP files directly in mu-plugins/. It does not load plugins nested in subdirectories like mu-plugins/media-categories/media-categories.php. You need an autoloader (or a tiny stub) for subdirectory must-use plugins.
Recommended: Roots Bedrock Autoloader — it scans mu-plugins/*/*.php for plugin headers and includes them. Ships with Bedrock; usable in any WordPress project as roots/bedrock-autoloader. Once loaded, this package shows under Plugins → Must-Use (not the toggleable Plugins list).
Without an autoloader, add a one-line stub at the mu-plugins root:
Optional fluent config in your theme functions.php (runs before the deferred default boot):
If you never call register(), the plugin bootstrap starts with defaults on init priority 1.
2. Traditional plugin install (download as a zip)
For sites that don’t use Composer — install it like any other WordPress plugin:
- Open the GitHub repository page.
- Click the green Code button, then Download ZIP.
- Unzip the file. You’ll get a folder named something like
cloakwp-media-categories-main. - Rename that folder to
media-categories(optional but keeps the Plugins list tidy). - Install it in either way:
- WordPress admin: Plugins → Add New → Upload Plugin → choose the zip (re-zip the renamed folder if you renamed it) → Install Now → Activate, or
- Manually: upload the
media-categoriesfolder intowp-content/plugins/on your server (via FTP/SFTP or your host’s file manager), then go to Plugins and click Activate.
Same defaults as the Composer path. Developers can still override config via fluent register() or the config filter (below). No mu-plugin autoloader needed.
Fluent API
manageRoles vs assignRoles
| Method | Capability | Who can… |
|---|---|---|
manageRoles |
manage_media_categories |
Create, rename, parent, delete categories (incl. “Add New” in the sidebar) |
assignRoles |
assign_media_categories |
Check categories on attachments, filter, bulk add/remove |
Assignment also requires edit_post on the attachment. Same split as WordPress manage_categories / assign_categories.
Config filter
Admin features
- List view: hierarchical filter dropdown (incl. Uncategorized), optional Not in, taxonomy column, bulk “Edit media categories…”
- Grid / media modal: hierarchical multi-select filter with In / Not in (including ACF Image, Gallery, and File field pickers)
- Attachment sidebar: checklist + Add New Media Category (REST
POST /wp/v2/media-categories) - Grid Bulk select: Add to selected / Remove from selected via
POST /wp-json/media-categories/v1/bulk-assign
Data model
Uses core taxonomy tables only (wp_terms, wp_term_taxonomy, wp_term_relationships) via wp_set_object_terms(). No custom tables, no options UI that saves config to the database (configure via PHP).
Default taxonomy slug: category_media.
Compatibility note: If you currently use WP Media Category Management, deactivate that plugin and activate this one. Assignments live in core term tables:
- Same taxonomy slug (
category_mediaby default on both) — terms and assignments stay as-is. - MCM was set to a different taxonomy (
category, a custom slug, etc.) — a one-time per-site import copies attachment assignments onto this plugin’s taxonomy (append-only; existing terms are not replaced). - Term counts are recalculated with
_update_generic_term_countso unattached media is included in library filter counts (WordPress’s default post-count callback skips those).
Architecture (Core + Plugin)
Media Library list/grid/modal filtering uses CloakWP\Core\Media\LibraryFilter (shared with Media Orientation). This package supplies the custom hierarchical UI and taxonomy query; the primitive owns restrict_manage_posts, pre_get_posts, ajax_query_attachments_args, and AttachmentsBrowser toolbar patching.
Development
License
LGPL-3.0-only