Media Library Tools 2.4.0 has 9 actions and 46 filters, read directly from its source code on Nov 18, 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 Media Library Tools fires an action
add_action( 'tsmlt_auto_process_exif', function( $attachment_id, $exif_data, $options ) {
// Your code runs here.
}, 10, 3 );
// Change a value Media Library Tools is about to use
add_filter( 'tsmlt/settings/before/save', function( $stored, $params ) {
// Change $stored here.
return $stored;
}, 10, 2 );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
-
/** * Allow the Pro plugin to persist its own compression settings. */ apply_filters( 'tsmlt/settings/before/save', $stored, $params ); -
/** * Filter the final bulk prompt sent to the AI provider. */ apply_filters( 'tsmlt_ai_bulk_prompt', $prompt, $fields, $attachment_id, $settings ); -
/** * Filter the final prompt sent to the AI provider. */ apply_filters( 'tsmlt_ai_prompt', $prompt, $field_type, $attachment_id, $settings ); -
/** * Filter rename target filename. */ apply_filters( 'tsmlt_attachment_rename_to', $rename_to, $new_name, $post_id, $attachment ); -
/** * Allow plugins/themes to apply custom EXIF processing rules. */ do_action( 'tsmlt_auto_process_exif', $attachment_id, $exif_data, $options ); -
/** * Allow Pro plugin to handle GPS removal. Pro plugin should hook here and call * ExifStripper if available. */ do_action( 'tsmlt_auto_remove_gps_on_upload', $attachment_id ); -
/** * Filter the registered compression engines. */ apply_filters( 'tsmlt_compression_engines', $engines ); -
/** * Filter the registered conversion engines. */ apply_filters( 'tsmlt_conversion_engines', $engines ); -
/** * Filter whether a post may act as an attachment's parent. */ apply_filters( 'tsmlt_is_valid_attachment_parent', $is_valid, $parent_id, $parent ); -
/** * Filter the set of attachment IDs that should be ignored during permalink / * rendered-HTML scans because they appear as automatic fallbacks (Woo * placeholder, theme logo placeholders, etc.). */ apply_filters( 'tsmlt_used_where_fallback_attachment_ids', $ids ); -
/** * Filter the vocabulary of substrings used to identify image-shaped option * keys. Matched case-insensitively as substrings, so a token of `'logo'` * matches `'logo'`, `'header_logo'`, `'mobile_logo_id'`, etc. */ apply_filters( 'tsmlt_used_where_image_shaped_key_tokens', $tokens, $key ); -
/** * Filter the per-batch reclassification absolute minimum. Default 8. */ apply_filters( 'tsmlt_used_where_per_batch_pervasive_floor', 8 ); -
/** * Filter the per-batch reclassification ratio. Default 0.8 (80%). */ apply_filters( 'tsmlt_used_where_per_batch_pervasive_ratio', 0.8 ); -
/** * Filter the post types scanned for image usage. */ apply_filters( 'tsmlt_used_where_scannable_post_types', $types ); -
/** * Filter the absolute minimum distinct-post count required before an image is * reclassified as site-wide. Prevents the heuristic from triggering on very * small sites where any shared image dominates. */ apply_filters( 'tsmlt_used_where_sitewide_pervasive_floor', 5 ); -
/** * Filter the minimum share of scanned posts an image must appear on (via * permalink/rendered only) before it is reclassified as site-wide. Expressed * as a fraction 0–1. */ apply_filters( 'tsmlt_used_where_sitewide_pervasive_ratio', 0.5 ); -
/** * Filter the set of option-name prefixes skipped during the site-wide option * scan. Add custom prefixes for noisy options that don't contain image * references. */ apply_filters( 'tsmlt_used_where_skip_option_prefixes', $skip_prefixes ); -
/** * Filter the list of term meta keys that are known to store attachment IDs. */ apply_filters( 'tsmlt_used_where_term_image_meta_keys', $id_meta_keys ); -
/** * Filter the list of term meta keys that are known to store image URLs. */ apply_filters( 'tsmlt_used_where_term_image_url_meta_keys', $url_meta_keys ); -
apply_filters( 'tsmlt_ai_max_suggestion_count', 1 ); -
do_action( 'tsmlt_ai_prepare_image', $this, $attachment_id, $settings, $file_path ); -
apply_filters( 'tsmlt_registered_file_lookup', [ 'paths' => [], 'basenames' => [] ], [] ); -
do_action( 'tsmlt_after_register_taxonomy' ); -
apply_filters( 'tsmlt_ai_claude_image_content', [], $this->image_base64, $this->image_mime ); -
apply_filters( 'tsmlt_ai_gemini_image_parts', [], $this->image_base64, $this->image_mime ); -
apply_filters( 'tsmlt_ai_locale', get_locale() ); -
apply_filters( 'tsmlt_ai_openai_image_content', [], $this->image_base64, $this->image_mime ); -
apply_filters( 'tsmlt_bulk_exif_action', $result, $parameters['type'], $ids, $parameters ); -
apply_filters( 'tsmlt_compression_free_job_limit', self::FREE_JOB_LIMIT ); -
apply_filters( 'tsmlt_compression_tick_batch_size', $this->get_batch_size( $state ) ); -
apply_filters( 'tsmlt_default_file_extensions', [ 'pdf', 'zip', 'mp4', 'jpeg', 'jpg', 'php', 'log', 'png', 'svg', 'gif', 'DS_Store', 'bmp', 'tiff', 'webp', 'heif', 'raw', 'psd', 'eps', 'ico', 'cur', 'jp2' ] ); -
do_action( 'tsmlt_do_ajax_instant_action', $file_path, $table_name ); -
apply_filters( 'tsmlt_duplicate_scan_tick_batch_size', self::TICK_BATCH_SIZE ); -
apply_filters( 'tsmlt_exif_scan_tick_batch_size', self::TICK_BATCH_SIZE ); -
apply_filters( 'tsmlt_exif_to_caption', $result, $ids ); -
apply_filters( 'tsmlt_get_directory_list_paths_to_ignore', [ 'wp-content/uploads/elementor', 'wp-content/uploads/rtcl', 'wp-content/uploads/' . BackupManager::BACKUP_DIRNAME, ] ); -
apply_filters( 'tsmlt_instant_delete_excluded_extensions', [ 'svg', 'pdf' ] ); -
apply_filters( 'tsmlt_maximum_media_per_page', 1000 ); -
apply_filters( 'tsmlt_offer_notice', $this->the_options() ); -
apply_filters( 'tsmlt_regenerate_tick_batch_size', self::TICK_BATCH_SIZE ); -
do_action( 'tsmlt_register_taxonomy' ); -
apply_filters( 'tsmlt_registered_term_meta_attachment_keys', [ 'thumbnail_id', 'brand_thumbnail_id', 'product_brand_thumb', 'category_image_id', ] ); -
apply_filters( 'tsmlt_rubbish_scan_batch_size', 500 ); -
apply_filters( 'tsmlt_scan_permalink_enabled', true, $post ); -
apply_filters( 'tsmlt_scan_permalink_enabled_default', $setting ); -
apply_filters( 'tsmlt_skip_meta_keys', [ 'file', 'sizes', 'width', 'height', 'filesize', 'image_meta', '_wp_attached_file', '_elementor_source_image_hash', '_wc_attachment_source', '_wp_attachment_image_alt', '_wp_attachment_metadata', '_wp_old_slug', '_edit_lock', '_edit_last', '_original_file_url', '_tsmlt_image_usages', ] ); -
apply_filters( 'tsmlt_template_path', 'templates/' ); -
apply_filters( 'tsmlt_upload_max_svg_file_size', 500 * 1024 ); -
do_action( 'tsmlt/after_loaded' ); -
do_action( 'tsmlt/before_loaded' ); -
apply_filters( 'tsmlt/before/add/image/info', $image_meta, $options, $attachment_ID, $post_id ); -
apply_filters( 'wpml_element_language_details', null, $args ); -
apply_filters( 'wpml_get_element_translations', null, $info->trid, 'post_attachment' );
Generated from Media Library Tools'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: