Kindly EditDocumentationTry the editor

media-categories.php

Registers and queries media categorization used by the editor’s media library filters.

Responsibility#

Registers and queries media categorization used by the editor’s media library filters.

This is an implementation reference for the released 0.9.13 module. Internal PHP helpers are not a compatibility promise for third-party callers. Prefer the documented REST, Abilities, theme, and filter contracts.

WordPress hooks#

Operation Hook
apply_filters cantata_edit_media_category_providers
add_filter ajax_query_attachments_args
add_filter wp_generate_attachment_metadata
add_action rest_api_init

add_action and add_filter subscribe to a hook; do_action and apply_filters expose a hook. A subscription is not itself a new extension API. Dynamic hook names are not included in this literal inventory.

Function and method reference#

cantata_edit_filebird_active#

function cantata_edit_filebird_active(): bool

FileBird is active and its folder model is the one this adapter was written for.

Source location: includes/media-categories.php:23.

cantata_edit_filebird_folders#

function cantata_edit_filebird_folders(): array

The person's FileBird folders, in FileBird's own order and scope: [ [ id, name, parent ] ].

Implementation connections: cantata_edit_filebird_active.

Source location: includes/media-categories.php:28.

cantata_edit_filebird_allowed#

function cantata_edit_filebird_allowed( int $folder_id ): bool

A folder FileBird lets this person use: Uncategorized (0), or one of their folders. All (-1) is no filter.

Implementation connections: cantata_edit_filebird_folders.

Source location: includes/media-categories.php:40.

cantata_edit_media_tree#

function cantata_edit_media_tree( array $items, callable $id, callable $parent ): array

Terms or folders in tree order with their depth, keeping the owner's sibling order.

Source location: includes/media-categories.php:47.

cantata_edit_media_categories#

function cantata_edit_media_categories(): array

The category groups this site has: [ [ id, label, query (the media query key), prefix, file, terms: [ [ value, name, depth, count ] ] ] ]. "file" says whether an upload can be filed in the group's choice by this person.

Implementation connections: cantata_edit_filebird_active, cantata_edit_filebird_folders, cantata_edit_media_tree.

Source location: includes/media-categories.php:65.

cantata_edit_media_term_clause#

function cantata_edit_media_term_clause( string $pair ): ?array

A category clause for "taxonomy|slug" from the media window, checked against a registered attachment taxonomy.

Source location: includes/media-categories.php:90.

cantata_edit_and_tax_query#

function cantata_edit_and_tax_query( $prior, array $clause ): array

$clause ANDed with an existing tax_query, which keeps its own relation and nesting as one group.

Implementation connections: cantata_edit_filebird_active, cantata_edit_filebird_allowed, cantata_edit_media_categories, cantata_edit_media_term_clause.

Source location: includes/media-categories.php:99.

About this page

Documents Kindly Edit 0.9.16. Source: includes/media-categories.php. Theme choices and account permissions can change which controls appear.

Type a word or phrase to search the full documentation.