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.
// 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
-
/** * 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] ); -
/** * 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 ); -
/** * 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 ); -
RML/{($type===RML_TYPE_ALL?'User/Settings':'Folder/Meta')}/Groups
filter Copy link Customise this hook/** * 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')] ); -
/** * 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 ); -
/** * 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 ); -
/** * This hook is fired when RML gets activated. */ do_action( 'RML/Activate' ); -
/** * 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') ); -
/** * 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' => ''] ); -
/** * Reset a count cache for a folder or all folders. */ do_action( 'RML/Count/Reset', $folderId ); -
/** * 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 ); -
/** * Use this hook to register your own creatables with the help of * wp_rml_register_creatable(). */ do_action( 'RML/Creatable/Register' ); -
/** * This content is showed in the attachment details below the custom field * dropdown. */ apply_filters( 'RML/CustomField', '', $post, $isShortcut, $form_fields ); -
/** * 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' ); -
/** * 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 ); -
/** * A new folder is created. */ do_action( 'RML/Folder/Created', $this->parent, $this->name, $this->getType(), $this->id ); -
/** * 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 ); -
/** * This action is fired after a folder is deleted. */ do_action( 'RML/Folder/Deleted', $id, $rowData ); -
/** * 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 ); -
/** * 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 ); -
/** * 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 ); -
/** * Modify the query arguments to fetch attachments within a folder. */ apply_filters( 'RML/Folder/QueryArgs', $args ); -
/** * 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] ); -
/** * The folder content (attachments) is fetched. */ apply_filters( 'RML/Folder/QueryResult', $posts ); -
/** * This action is called before a folder gets renamed. */ do_action( 'RML/Folder/Rename', $name, $this ); -
/** * This action is called when a folder was renamed. */ do_action( 'RML/Folder/Renamed', $name, $this, $oldData ); -
/** * 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() ); -
/** * 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() ); -
/** * 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 ); -
/** * An attachment is moved to a specific folder. */ do_action( 'RML/Item/Moved', $postId, $oldFolder, $fid, $isShortcut ); -
/** * This action is fired after items gets moved to a specific folder. */ do_action( 'RML/Item/MoveFinished', $this->id, $ids, $this, $isShortcut, $sourceFolders ); -
/** * Allows you to register new options tabs and fields to the Real Media Library * options panel (Settings > Media). */ do_action( 'RML/Options/Register' ); -
/** * 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 ); -
/** * Get the root folder id which is showed in the folder tree. */ apply_filters( 'RML/ParentRoot', -1, \get_current_blog_id() ); -
/** * This action is fired after whole reset. */ do_action( 'RML/Reset' ); -
/** * This action is fired after folder / attachment relations reset. */ do_action( 'RML/Reset/Relations' ); -
/** * This action is fired when RML has enqueued scripts and styles. */ do_action( 'RML/Scripts', $this ); -
/** * 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 ); -
/** * This content is showed in the attachment details. It shows informations * about the shortcut. */ apply_filters( 'RML/Shortcut/Info', $output, $post, $shortcut ); -
/** * Counts all attachments which are available in the structure. */ apply_filters( 'RML/Tree/CountAttachments', 0, $this ); -
/** * 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 ); -
/** * 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 ); -
/** * 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 ); -
/** * 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 ); -
/** * The tree content is loaded. */ apply_filters( 'RML/Tree/SQLRows', $this->rows, $this ); -
/** * 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 ); -
/** * 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... ); -
/** * 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 ); -
/** * Add WHERE statement to modify parts of the tree SQL statement. */ apply_filters( 'RML/Tree/SQLStatement/WHERE', '', $this ); -
/** * 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() ); -
/** * 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 ); -
/** * Checks if a creation of a folder is allowed. */ apply_filters( 'RML/Validate/Create', $errors, $name, $parent, $type ); -
/** * Checks if an attachment can be inserted into a folder. */ apply_filters( 'RML/Validate/Insert', [], $id, $this ); -
/** * Checks if a folder can be renamed. */ apply_filters( 'RML/Validate/Rename', [], $name, $this ); -
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... ); -
apply_filters( 'RML/Validate/Delete', [], $id, $folder ); -
apply_filters( 'wpml_active_languages', [] ); -
apply_filters( 'wpml_is_translated_post_type', \false, 'attachment' ); -
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.
Custom hook snippet
from $49
A small, update-safe change built on the plugin’s own hooks.
- Code written against the plugin’s actions and filters
- Tested on a staging copy of your site
- Install instructions included
Typical turnaround: 2–3 business days
Choose thisPlugin 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 thisNot 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: