Skip to the document
DocsReference

Hooks and constants

Everything here is in the plugin's own namespace. WordPress's own hooks for taxonomies, terms and attachments work normally, because folders are terms — so before reaching for anything on this page, check whether get_terms, wp_set_object_terms or pre_get_posts already does what you want.

Prefix: vergeml_. Text domain: vergelabs-media-library.


Filters #

Folders and assignment #

FilterDefaultSignature
vergeml_auto_assign_termsthe parent's terms( array $terms, int $attachment_id, WP_Post $parent, string $taxonomy )
vergeml_multilingual_shared_folderstrue( bool $shared ) — return false for per-language folders
vergeml_replace_parent_columntrue( bool $replace ) — whether to replace core's parent column

Smart folders and the scan #

FilterDefaultSignature
vergeml_smart_foldersthe five built-in( array $folders )
vergeml_smart_query_argsper key( array $args, string $key )
vergeml_smart_count_branchesarray()( array $branches ) — each array( 'sql' => …, 'args' => array() )
vergeml_smart_count_exclude''( string $sql )
vergeml_scan_chunk200( int $posts_per_chunk )
vergeml_large_file_bytesMB_IN_BYTES( int $bytes )

Importing #

FilterDefaultSignature
vergeml_import_sourcesseven plugins( array $sources )
vergeml_import_chunk500( int $rows_per_chunk )

The AI layer #

FilterDefaultSignature
vergeml_ai_parallel8( int $in_flight ) — describe calls at once
vergeml_meaning_budget_ms2000( int $ms ) — time a meaning search may spend, floor 500
vergeml_autofile_vectornull( ?array $vector, int $attachment_id ) — supply your own vector
vergeml_nl_parsenull( ?array $intent, string $text ) — put your own parser in front of the built-in one

A vergeml_nl_parse implementation still has to name a verb from the allowlist (move, tag, rename, create) and a selection the plugin can resolve, and it still cannot run anything by itself. See Say what you want.

Sorting runs and clustering #

FilterDefaultSignature
vergeml_librarian_taxonomyyour primary folder taxonomy( string $taxonomy )
vergeml_librarian_chunk25( int $files ) — floor of 5
vergeml_organize_batch200( int $files ) — clamped to 50…2000
vergeml_organize_dims64( int $dims ) — minimum 4
vergeml_organize_width6( int $folders_per_level ) — minimum 2
vergeml_organize_max_depth3( int $levels ) — minimum 1
vergeml_organize_min_branch5( int $files ) — minimum 1
vergeml_organize_max_branch50( int $files ) — minimum 2
vergeml_organize_outlier3.0( float $distance )

Screens and reporting #

FilterDefaultSignature
vergeml_journey_stagesthe dashboard's stages( array $stages )
vergeml_journey_todothe next action( array $todo )
vergeml_help_textsthe built-in help copy( array $texts )
vergeml_system_reportthe support report( array $report )

Actions #

ActionWhenPassed
vergeml_activateOn activation, after options are written—
vergeml_set_optionsWhen options are (re)written, including migrations—
vergeml_set_site_optionsThe multisite equivalent—
vergeml_extend_settings_pageInside the settings screen—
vergeml_admin_home_cardsOn the Dashboard, where cards are printed—
vergeml_ai_page_cardsOn the AI screen—
vergeml_health_page_cardsOn the Duplicates screen—
vergeml_librarian_page_topAbove the Folders screen—
vergeml_librarian_page_cardsOn the Folders screen—

Add-on integration points also exist for options and transients an add-on registers (vergeml_pro_add_options, vergeml_pro_add_transients) so a complete cleanup removes them too.


Constants #

Set these in wp-config.php #

ConstantEffect
VERGEML_AI_SERVICEPoint the AI client at another base URL. Development only. Non-HTTPS values are refused. There is deliberately no filter for this: requests carry your licence key, and a filter would let any co-installed plugin redirect them
VERGEML_AI_MOCKForce demo mode. Captions are invented locally and nothing is sent
VERGEML_AI_ALLOW_NONPRODAllow describing from a non-production environment. Off by default so a clone cannot spend your balance
VERGEML_NO_WATCHDOGDo not install the fatal-error handler
VERGEML_SAFE_MODEForce safe mode on

Defined by the plugin, overridable before load #

Useful ones. Every value below is the shipped default.

ConstantDefaultWhat it controls
VERGEML_VERSION4.1.0—
VERGEML_MENUvergelabs-mediaThe top-level menu slug
VERGEML_REST_NSvergeml/v1REST namespace
VERGEML_AI_PARALLEL8Describe calls in flight
VERGEML_AI_STEP_MAX24Files per on-screen step
VERGEML_AI_RUN_CHUNK8Files per background chunk
VERGEML_AI_RUN_BUDGET20Seconds of work per cron tick
VERGEML_AI_RUN_GAP30Seconds before the next tick is due
VERGEML_AI_HOLD_SECONDS600A file described this recently is held back
VERGEML_INDEX_BATCH100Index rows read per pass
VERGEML_MEANING_BUDGET2000Milliseconds a meaning search may spend
VERGEML_MEANING_CHUNK5000Projection rows read per query
VERGEML_MEANING_FLOOR0.22Similarity below which a hit is not a hit
VERGEML_HEALTH_BATCH25Attachments hashed per batch
VERGEML_HEALTH_CAP200Maximum per request
VERGEML_HEALTH_NEAR5Hamming distance for a near-duplicate
VERGEML_HEALTH_MIN_SIDE64Smallest image the dHash will judge
VERGEML_QUARANTINE_DAYS30The floor before a set-aside file is even eligible. Not a setting
VERGEML_AUTOFILE_EARN5Accepted suggestions before a folder may file on its own
VERGEML_AUTOFILE_MARGIN1.25How much nearer the winning folder must be
VERGEML_AUTOFILE_REACH1.5Beyond this, no suggestion at all
VERGEML_CSV_MAX_ROWS200000CSV import ceiling
VERGEML_CSV_MAX_DEPTH12CSV nesting ceiling

Working with folders directly #

You rarely need any of the above. Folders are terms:

// Which folders is this file in?
$folders = wp_get_object_terms( $attachment_id, 'media_category' );

// File it into one, keeping the others.
wp_set_object_terms( $attachment_id, array( $term_id ), 'media_category', true );

// Every file in a folder, and its sub-folders.
$q = new WP_Query( array(
    'post_type'      => 'attachment',
    'post_status'    => 'inherit',
    'posts_per_page' => -1,
    'tax_query'      => array( array(
        'taxonomy'         => 'media_category',
        'field'            => 'term_id',
        'terms'            => $term_id,
        'include_children' => true,
    ) ),
) );

Colour and manual order are term meta: vergeml_color and vergeml_order.

Written from version 3.15.0 of the plugin. Last updated 2026-10-02. All documentation · Legal · Support