Real Media Library: Media Library Folder & File Manager icon
Media, Galleries & Sliders

Real Media Library: Media Library Folder & File Manager hooks reference

Real Media Library: Media Library Folder & File Manager 4.23.12 has 21 actions and 38 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when Real Media Library: Media Library Folder & File Manager fires an action
add_action( 'RML/Activate', function() {
	// Your code runs here.
}, 10, 1 );

// Change a value Real Media Library: Media Library Folder & File Manager is about to use
add_filter( 'RML/Active', function( $upload_files ) {
	// Change $upload_files here.
	return $upload_files;
}, 10, 1 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • inc/folder/Folder.php line 42 · used in 2 places
    /**
     * Get allowed children folder types for a given folder type. $type can be
     * replaced with RML_TYPE_FOLDER for example.
     */
    apply_filters( "RML/Folder/Types/{$this->getType()}", [RML_TYPE_FOLDER, RML_TYPE_COLLECTION] );
  • inc/overrides/lite/folder/Creatable.php line 80
    /**
     * This action is called when a folder was relocated in the folder tree. That
     * means the parent was not changed, only the order was changed.
     */
    do_action( "{$isRelocate?}RML/Folder/Relocate{:}RML/Folder/Move", $this, $rootFolderId, $newOrder, $force );
  • inc/overrides/lite/folder/Creatable.php line 110
    /**
     * This action is called when a folder was relocated in the folder tree. That
     * means the parent was not changed, only the order was changed.
     */
    do_action( "{$isRelocate?}RML/Folder/Relocated{:}RML/Folder/Moved", $this, $rootFolderId, $this->order, $force, $oldData );
  • inc/metadata/Meta.php line 85
    /**
     * Add a tab group to the folder details or user settings dialog. You cam use
     * this function together with add_rml_meta_box() or
     * add_rml_user_settings_box(). Allowed $types: "User/Settings"|"Folder/Meta".
     */
    apply_filters( "RML/{($type===RML_TYPE_ALL?'User/Settings':'Folder/Meta')}/Groups", ['general' => \__('General', 'real-media-library-lite')] );
  • inc/Util.php line 83
    /**
     * Add a condition after a defined action ($action) to check if any parent has
     * a metadata. It also includes the self folder so you can check for own folder
     * metadata. <strong>Note:</strong> All found parents are grouped and passed
     * through an action RML/$action/AnyParentHasMeta/$meta_key so you can execute
     * your command. The allowed $actions are: <ul> <li>"Folder/Insert": Items are
     * moved to the folde...
     */
    apply_filters( "RML/{$action}/AnyParentHasMeta", [], $folder, $args );
  • inc/Util.php line 103
    /**
     * This action is called for the results of the RML/$action/AnyParentHasMeta
     * filter. <strong>Note:</strong> The allowed $actions are: See
     * RML/$action/AnyParentHasMeta
     */
    do_action( "RML/{$action}/AnyParentHasMeta/{$meta_key}", $metas, $folder, $args, $rows );
  • inc/Activator.php line 33
    /**
     * This hook is fired when RML gets activated.
     */
    do_action( 'RML/Activate' );
  • inc/api/folders.php line 435
    /**
     * Checks if RML is active for the current user. Do not use this filter
     * yourself, instead use wp_rml_active() function!
     */
    apply_filters( 'RML/Active', \current_user_can('upload_files') );
  • inc/attachment/CountCache.php line 108
    /**
     * Get the posts clauses for the count cache.
     */
    apply_filters( 'RML/Count/PostsClauses', ['from' => $this->getTableName('posts') . ' AS rmlpostscnt', 'where' => 'rmlpostscnt.fid = tn.id', 'afterWhere' => ''] );
  • inc/attachment/CountCache.php line 135
    /**
     * Reset a count cache for a folder or all folders.
     */
    do_action( 'RML/Count/Reset', $folderId );
  • inc/attachment/CountCache.php line 87
    /**
     * The folder needs to be updated. If minimum one hook exists the update on the
     * main table is no longer executed. This action is used for example for the
     * WPML compatibility.
     */
    do_action( 'RML/Count/Update', $folders, $attachments, $where );
  • inc/attachment/Structure.php line 172
    /**
     * Use this hook to register your own creatables with the help of
     * wp_rml_register_creatable().
     */
    do_action( 'RML/Creatable/Register' );
  • inc/attachment/CustomField.php line 61
    /**
     * This content is showed in the attachment details below the custom field
     * dropdown.
     */
    apply_filters( 'RML/CustomField', '', $post, $isShortcut, $form_fields );
  • inc/Core.php line 203
    /**
     * This function is called at the end of: AJAX Handler, WP Handler, REST
     * Handler. You can collect for example batch actions and merge it to one SQL
     * query.
     */
    do_action( 'RML/Die' );
  • inc/attachment/Filter.php line 88
    /**
     * Do a filter to restrict the RML posts clauses and apply an own clauses
     * modifier. If you want to use your own implementation of posts_clauses you
     * can add this code to to restrict the RML standard posts_clauses:
     * <code>$clauses["_restrictRML"] = true;</code>
     */
    apply_filters( 'RML/Filter/PostsClauses', $clauses, $query, $folderId, $root );
  • inc/folder/Creatable.php line 216
    /**
     * A new folder is created.
     */
    do_action( 'RML/Folder/Created', $this->parent, $this->name, $this->getType(), $this->id );
  • inc/folder/CRUD.php line 140
    /**
     * This action is fired before a folder gets deleted and surely gets deleted
     * (that means after the RML/Folder/Predeletion action).
     */
    do_action( 'RML/Folder/Delete', $folder );
  • inc/folder/CRUD.php line 160
    /**
     * This action is fired after a folder is deleted.
     */
    do_action( 'RML/Folder/Deleted', $id, $rowData );
  • inc/metadata/Meta.php line 121
    /**
     * Add content to the folder metabox. Do not use this filter directly instead
     * use the add_rml_meta_box() function! If you want to add content to the
     * "General" tab you can use the filter `RML/Folder/Meta/Content`.
     */
    apply_filters( "RML/Folder/Meta/Content{$hookAddition}", '', $folder );
  • inc/rest/Folder.php line 222
    /**
     * This filter is called to save the metadata. You can use the $_POST fields to
     * validate the input. If an error occurs you can pass an "error" array
     * (string) to the response. Do not use this filter directly instead use the
     * add_rml_meta_box() function!
     */
    apply_filters( 'RML/Folder/Meta/Save', ['errors' => [], 'data' => []], $folder, $request );
  • inc/folder/CRUD.php line 131
    /**
     * This action is fired before a folder gets deleted. It allows you for example
     * to throw an exception if the deletion should be stopped with an error
     * message.
     */
    do_action( 'RML/Folder/Predeletion', $folder );
  • inc/folder/Creatable.php line 409
    /**
     * Modify the query arguments to fetch attachments within a folder.
     */
    apply_filters( 'RML/Folder/QueryArgs', $args );
  • inc/folder/BaseFolder.php line 220
    /**
     * Modify the query arguments to count items within a folder.
     */
    apply_filters( 'RML/Folder/QueryCountArgs', ['post_status' => 'inherit', 'post_type' => 'attachment', 'rml_folder' => $this->id] );
  • inc/folder/Creatable.php line 419
    /**
     * The folder content (attachments) is fetched.
     */
    apply_filters( 'RML/Folder/QueryResult', $posts );
  • inc/folder/Creatable.php line 344
    /**
     * This action is called before a folder gets renamed.
     */
    do_action( 'RML/Folder/Rename', $name, $this );
  • inc/folder/Creatable.php line 364
    /**
     * This action is called when a folder was renamed.
     */
    do_action( 'RML/Folder/Renamed', $name, $this, $oldData );
  • inc/folder/Creatable.php line 299
    /**
     * Filter the description for a custom folder type.
     */
    apply_filters( 'RML/Folder/Type/Description', $default === null ? \__('A folder can contain every type of file or a collection, but not gallery.', 'real-media-library-lite') : $default, $this->getType(), $this->getId() );
  • inc/folder/Creatable.php line 285
    /**
     * Filter the description name for a custom folder type.
     */
    apply_filters( 'RML/Folder/Type/Name', $default === null ? \__('Folder', 'real-media-library-lite') : $default, $this->getType(), $this->getId() );
  • inc/folder/Creatable.php line 120
    /**
     * This action is fired before items gets moved to a specific folder. It allows
     * you for example to throw an exception with an error message to cancel the
     * movement.
     */
    do_action( 'RML/Item/Move', $this->id, $ids, $this, $isShortcut );
  • inc/attachment/Shortcut.php line 115
    /**
     * An attachment is moved to a specific folder.
     */
    do_action( 'RML/Item/Moved', $postId, $oldFolder, $fid, $isShortcut );
  • inc/folder/Creatable.php line 143
    /**
     * This action is fired after items gets moved to a specific folder.
     */
    do_action( 'RML/Item/MoveFinished', $this->id, $ids, $this, $isShortcut, $sourceFolders );
  • inc/view/Options.php line 67
    /**
     * Allows you to register new options tabs and fields to the Real Media Library
     * options panel (Settings > Media).
     */
    do_action( 'RML/Options/Register' );
  • inc/order/Sortable.php line 71
    /**
     * Add an available order criterium to folder content. If you pass user input
     * to the SQL Order please be sure the values are escaped!
     */
    apply_filters( 'RML/Order/Orderby', $orders );
  • inc/api/folders.php line 412
    /**
     * Get the root folder id which is showed in the folder tree.
     */
    apply_filters( 'RML/ParentRoot', -1, \get_current_blog_id() );
  • inc/rest/Reset.php line 188
    /**
     * This action is fired after whole reset.
     */
    do_action( 'RML/Reset' );
  • inc/rest/Reset.php line 152
    /**
     * This action is fired after folder / attachment relations reset.
     */
    do_action( 'RML/Reset/Relations' );
  • inc/Assets.php line 113
    /**
     * This action is fired when RML has enqueued scripts and styles.
     */
    do_action( 'RML/Scripts', $this );
  • inc/Assets.php line 68
    /**
     * Checks if assets for RML should be skipped. This can be useful in
     * combination with page builders.
     */
    apply_filters( 'RML/Scripts/Skip', \false, $type, $hook_suffix );
  • inc/attachment/CustomField.php line 124
    /**
     * This content is showed in the attachment details. It shows informations
     * about the shortcut.
     */
    apply_filters( 'RML/Shortcut/Info', $output, $post, $shortcut );
  • inc/attachment/Structure.php line 323
    /**
     * Counts all attachments which are available in the structure.
     */
    apply_filters( 'RML/Tree/CountAttachments', 0, $this );
  • inc/folder/Creatable.php line 446
    /**
     * Add an available order criterium to the tree. If you pass user input to the
     * SQL Order please be sure the values are escaped!
     */
    apply_filters( 'RML/Tree/Orderby', $orders );
  • inc/attachment/Structure.php line 207
    /**
     * Here you can modify the fresh-created instances of an IFolder object. This
     * allows you, e. g. hide folders on frontend with `setVisible`.
     */
    apply_filters( 'RML/Tree/Parsed', $this->parsed );
  • inc/attachment/Structure.php line 276
    /**
     * When a folder is not found by an absolute path this filter is called and
     * looks up for folders which are perhaps handled by other structures. If you
     * are hooking into this function please consider that you apply_filters for
     * RML/Tree/Parsed manually.
     */
    apply_filters( 'RML/Tree/ResolveByAbsolutePath', null, $path, $this );
  • inc/attachment/Structure.php line 252
    /**
     * When a folder is not found by an absolute path this filter is called and
     * looks up for folders which are perhaps handled by other structures. If you
     * are hooking into this function please consider that you apply_filters for
     * RML/Tree/Parsed manually.
     */
    apply_filters( 'RML/Tree/ResolveById', null, $id, $this );
  • inc/attachment/Structure.php line 157
    /**
     * The tree content is loaded.
     */
    apply_filters( 'RML/Tree/SQLRows', $this->rows, $this );
  • inc/attachment/Structure.php line 145
    /**
     * Modify the full tree SQL statement.
     */
    apply_filters( 'RML/Tree/SQLStatement', ["SELECT {$fields} FROM {$table_name} AS tn {$joins} {$where} ORDER BY parent, ord"], $this );
  • inc/attachment/Structure.php line 117
    /**
     * Modify the tree SQL select join statement. Just push your joins to $fields
     * array.
     */
    apply_filters( 'RML/Tree/SQLStatement/JOIN', [ 'LEFT JOIN ' . $this->getTableName('meta') . " rml_meta_orderby ON rml_meta_orderby.realmedialibrary_id = tn.ID AND rml_meta_orderby.meta_key = 'orderby'", 'LEFT JOIN ' . $this->getTableName('meta') . " rml_meta_orderAutomatically ON rml_meta_orderAutomatically.realmedialibrary_id = tn.ID AND rml_meta_orderAutomatically.meta_key = 'orderAutomatically'", 'LEFT JOIN ' . $this->getTableName('met... );
  • inc/attachment/Structure.php line 98
    /**
     * Modify the tree SQL select fields statement. Just push your fields to select
     * custom fields.
     */
    apply_filters( 'RML/Tree/SQLStatement/SELECT', [ 'tn.*', 'IFNULL(tn.cnt, (' . \MatthiasWeb\RealMediaLibrary\attachment\CountCache::getInstance()->getSingleCountSql() . ')) AS cnt_result', 'rml_meta_orderby.meta_value AS lastOrderBy', 'rml_meta_orderAutomatically.meta_value AS orderAutomatically', 'rml_meta_lastSubOrderBy.meta_value AS lastSubOrderBy', 'rml_meta_subOrderAutomatically.meta_value AS subOrderAutomatically', ], $this );
  • inc/attachment/Structure.php line 136
    /**
     * Add WHERE statement to modify parts of the tree SQL statement.
     */
    apply_filters( 'RML/Tree/SQLStatement/WHERE', '', $this );
  • inc/metadata/Meta.php line 108
    /**
     * Add content to the general settings. Do not use this filter directly instead
     * use the add_rml_user_settings_box() function! If you want to add content to
     * the "General" tab you can use the filter `RML/User/Settings/Content`.
     */
    apply_filters( "RML/User/Settings/Content{$hookAddition}", '', \get_current_user_id() );
  • inc/rest/Service.php line 125
    /**
     * This filter is called to save the general user settings. You can use the
     * $_POST fields to validate the input. If an error occurs you can pass an
     * "error" array (string) to the response. Do not use this filter directly
     * instead use the add_rml_user_settings_box() function!
     */
    apply_filters( 'RML/User/Settings/Save', ['errors' => [], 'data' => []], \get_current_user_id(), $request );
  • inc/folder/CRUD.php line 67
    /**
     * Checks if a creation of a folder is allowed.
     */
    apply_filters( 'RML/Validate/Create', $errors, $name, $parent, $type );
  • inc/folder/Creatable.php line 168
    /**
     * Checks if an attachment can be inserted into a folder.
     */
    apply_filters( 'RML/Validate/Insert', [], $id, $this );
  • inc/folder/Creatable.php line 330
    /**
     * Checks if a folder can be renamed.
     */
    apply_filters( 'RML/Validate/Rename', [], $name, $this );
  • inc/Assets.php line 155
    apply_filters( 'RML/Localize', \array_merge(['showLicenseFormImmediate' => $showLicenseFormImmediate, 'isDevLicense' => $isDevLicense, 'isBlockApiVersion3Supported' => \version_compare($wp_version, '6.3', '>='), 'licenseActivationLink' => $pluginUpdater->getView()->getActivateLink(\true), 'canManageOptions' => \current_user_can('manage_options'), 'liteHasSubfolders' => $liteHasSubfolders, 'childrenSql' => \intval(\get_option... );
  • inc/folder/CRUD.php line 118
    apply_filters( 'RML/Validate/Delete', [], $id, $folder );
  • inc/comp/WPML.php line 349
    apply_filters( 'wpml_active_languages', [] );
  • inc/comp/WPML.php line 356
    apply_filters( 'wpml_is_translated_post_type', \false, 'attachment' );
  • inc/comp/WPML.php line 340
    apply_filters( 'wpml_object_id', $attachment, 'post', \true, $sitepress->get_default_language() );

Generated from Real Media Library: Media Library Folder & File Manager's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Done for you

Rather have it built for you?

Tell us what should change and we’ll write and test the code using these hooks.

Plugin customisation

from $149

New features or changed behaviour, without editing the plugin’s files.

  • Built as a companion plugin, so updates never wipe it
  • Exact quote before we start
  • Tested on staging, then deployed

Typical turnaround: 3–7 business days

Choose this

Not sure which fits? Describe what you need and we’ll suggest the simplest option.

Can't find the right hook?

We can build the customisation for you. Describe what you need: