Enable Media Replace icon
Media, Galleries & Sliders

Enable Media Replace hooks reference

  • By ShortPixel
  • v4.2.3
  • Updated

Enable Media Replace 4.2.3 has 15 actions and 31 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 Enable Media Replace fires an action
add_action( 'breeze_clear_all_cache', function() {
	// Your code runs here.
}, 10, 1 );

// Change a value Enable Media Replace is about to use
add_filter( 'emr/replace/default_type', function( $value, $attachment_id ) {
	// Change $value here.
	return $value;
}, 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

  • classes/ViewController/ReplaceViewController.php line 82
    /**
     * Filters the default replace_type ('replace' or 'replace_and_search') shown
     * on the media replace screen. Overrides whatever was last remembered in the
     * stored option.
     */
    apply_filters( 'emr/replace/default_type', $this->view->settings['replace_type'], $attachment_id );
  • classes/Controller/ReplaceController.php line 262 · used in 4 places
    apply_filters( 'emr_unfiltered_get_attached_file', true );
  • build/shortpixel/filesystem/src/Model/File/DirectoryModel.php line 271 · used in 3 places
    apply_filters( 'emr/file/basedir_check', $restricted );
  • build/shortpixel/replacer2/src/Modules/Elementor.php line 53 · used in 2 places
    apply_filters( 'emr/externals/elementor_is_active', $bool );
  • build/shortpixel/replacer2/src/Modules/WpBakery.php line 48 · used in 2 places
    apply_filters( 'emr/externals/urlencode_is_active', $bool );
  • classes/ViewController/ReplaceViewController.php line 89 · used in 2 places
    apply_filters( 'emr/replace/file_is_movable', true, $attachment_id );
  • classes/Controller/ReplaceController.php line 269 · used in 2 places
    apply_filters( 'emr/replace/original_image_path', $source_file, $this->post_id );
  • emr/upsell

    filter
    views/success.php line 20 · used in 2 places
    apply_filters( 'emr/upsell', current_user_can('install_plugins') );
  • classes/cache.php line 181
    do_action( 'breeze_clear_all_cache' );
  • classes/cache.php line 186
    do_action( 'cache_enabler_clear_complete_cache' );
  • classes/Controller/ReplaceController.php line 463
    do_action( 'emr_after_remove_current', $this->post_id, $meta, $backup_sizes, $this->sourceFile, $this->targetFile );
  • views/screen.php line 173
    do_action( 'emr_after_replace_type_options' );
  • views/screen.php line 152
    do_action( 'emr_after_search_type_options' );
  • views/screen.php line 135
    do_action( 'emr_before_replace_type_options' );
  • views/screen.php line 138
    apply_filters( 'emr_display_replace_type_options', true );
  • emr_returnurl

    filter
    classes/uihelper.php line 76
    apply_filters( 'emr_returnurl', $url );
  • classes/uihelper.php line 105
    apply_filters( 'emr_returnurl_failed', $url );
  • classes/Controller/ReplaceController.php line 351
    apply_filters( 'emr_unique_filename', $unique, $path, $this->post_id );
  • classes/cache.php line 123
    do_action( 'emr/cache/flush', $post_id );
  • classes/Controller/ReplaceController.php line 184
    do_action( 'emr/converter/prevent-offload', $this->post_id );
  • classes/Controller/ReplaceController.php line 186
    do_action( 'emr/converter/prevent-offload-off', $this->post_id );
  • classes/emr-plugin.php line 61
    apply_filters( 'emr/feature/background', true );
  • classes/emr-plugin.php line 62
    apply_filters( 'emr/feature/remote_notice', true );
  • build/shortpixel/filesystem/src/Model/File/FileModel.php line 146
    apply_filters( 'emr/file/exists', $this->exists, $this->fullpath, $this );
  • classes/Controller/ReplaceController.php line 290
    apply_filters( 'emr/file/virtual/translate', $sourceFileObj->getFullPath(), $sourceFileObj, $this->post_id );
  • build/shortpixel/filesystem/src/Controller/FileSystemController.php line 73
    apply_filters( 'emr/filesystem/abspath', $abspath );
  • build/shortpixel/filesystem/src/Model/File/FileModel.php line 377
    do_action( 'emr/filesystem/addfile', array($destinationPath, $destination, $this, $is_new) );
  • build/shortpixel/filesystem/src/Model/File/FileModel.php line 556
    apply_filters( 'emr/filesystem/processFilePath', $path, $original_path );
  • build/shortpixel/filesystem/src/Model/File/FileModel.php line 675
    apply_filters( 'emr/image/urltopath', false, $url, $this->getRawFullPath() );
  • classes/Controller/ReplaceController.php line 232
    apply_filters( 'emr/replace/doreplace', true );
  • build/shortpixel/replacer2/src/Replacer.php line 476
    apply_filters( 'emr/replacer/content', $content, $search, $replace );
  • build/shortpixel/replacer2/src/Replacer.php line 241
    apply_filters( 'emr/replacer/custom_replace_query', array(), $base_url, $search_urls, $replace_urls );
  • build/shortpixel/replacer2/src/Replacer.php line 394
    apply_filters( 'emr/replacer/load_meta_value', $content, $row, $component );
  • build/shortpixel/replacer2/src/Replacer.php line 231
    do_action( 'emr/replacer/replace_urls', $search_urls, $replace_urls, $base_url );
  • build/shortpixel/replacer2/src/Replacer.php line 353
    apply_filters( 'emr/replacer/replacement_tables', $table_options );
  • build/shortpixel/replacer2/src/Replacer.php line 403
    apply_filters( 'emr/replacer/save_meta_value', $content, $row, $component );
  • classes/emr-plugin.php line 357
    apply_filters( 'emr/success/timeout', 5 );
  • classes/Controller/ReplaceController.php line 386
    apply_filters( 'enable_media_replace_title', $title );
  • classes/Controller/ReplaceController.php line 251
    do_action( 'enable-media-replace-upload-done', $target_url, $source_url, $this->post_id );
  • classes/cache.php line 171
    do_action( 'fastpixel/purge/all' );
  • classes/cache.php line 166
    do_action( 'litespeed_purge_all' );
  • build/shortpixel/filesystem/src/Model/File/FileModel.php line 145
    apply_filters( 'shortpixel_image_exists', $this->exists, $this->fullpath, $this );
  • classes/Controller/ReplaceController.php line 105
    do_action( 'wp_handle_replace', array('post_id' => $this->post_id) );
  • classes/Controller/ReplaceController.php line 159
    apply_filters( 'wp_handle_upload', array( 'file' => $this->targetFile->getFullPath(), 'url' => $this->getTargetURL(), 'type' => $this->targetFile->getMime(), ), 'sideload' );
  • classes/ViewController/UploadViewController.php line 186
    apply_filters( 'wp_handle_upload_prefilter', $uploadFileArray );

Generated from Enable Media Replace's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

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