WP Manifestindependent plugin directory
manifest / unclassified / custom-media-batch-processor

Custom Media Batch Processor

Optimize your site's performance and SEO by localizing external media. Custom Media Batch Processor recursively extracts, downloads, and sideloads remote images into your WordPress media library. It seamlessly updates post content and complex serialized metadata, including full Beaver Builder integration. Effortlessly batch-process your entire cata

by Ranked · github.com/nmskvideo-dot/custom-media-batch-processor

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/nmskvideo-dot/custom-media-batch-processor/archive/refs/heads/master.zip

Custom Media Batch Processor is a robust WordPress plugin designed to recursively extract, download, sideload, and replace external image URLs with local media library attachments across all standard post contents and custom post meta fields, featuring deep serialized data reconstruction and full integration with Beaver Builder.

Through a responsive AJAX-powered dashboard featuring a live debug console, you can process either a single post or bulk-process your entire catalog of posts sequentially without timeouts.


🚀 Key Features

  • Sequential AJAX Processing: Batch-process posts one-by-one, avoiding PHP execution timeout limits on large datasets.
  • Auto-Sideloading of External Images: Automatically extracts external images (.jpg, .jpeg, .png, .gif, .webp) from post content and downloads/inserts them into the WordPress Media Library.
  • Smart Duplication Prevention: Checks the Media Library first by filename using _wp_attached_file. If the image is already present locally, it skips the download and directly updates URLs.
  • Deep Recursive Metadata Sync: Replaces URLs not only in post_content but also recursively inside all post_meta keys, handling nested PHP arrays, objects, and serialized strings seamlessly.
  • Full Beaver Builder Compatibility: Designed to scan Beaver Builder layout data (_fl_builder_data and _fl_builder_draft), perform replacements, and automatically trigger FLBuilderModel cache clearing and asset regeneration.
  • Interactive Live Debug Console: Watch the processing status, counts (found, uploaded/replaced, skipped, failed), and detailed step-by-step logs scroll in real-time within the admin dashboard.

🛠️ Installation

  1. Download the plugin folder custom-media-batch-processor.
  2. Upload the folder to your WordPress installation directory under /wp-content/plugins/.
  3. Log in to your WordPress Dashboard, navigate to Plugins, and click Activate under Custom Media Batch Processor.

📖 Usage

Once activated, administrators can access the utility interface under: Tools ➔ Media Processor

1. Single Post Processing

  • Select a specific post from the searchable dropdown list.
  • Click Process Single Post to handle a single post on demand.
  • Monitor results in the live console.

2. Bulk Processing

  • View the total count of posts found.
  • Click Start Bulk Processing to begin sequential, automated processing of all posts.
  • The processing executes step-by-step asynchronously. You can watch the real-time activity log below the button.

⚙️ How It Works Behind the Scenes

  1. Extraction: The plugin scans the post_content and all post metadata values (including serialized data) using regular expressions to find external image URLs.
  2. Local Lookup: It extracts the file name from the URL and queries the Media Library.
    • If found: It binds the existing media's local URL.
    • If not found: It downloads the image using download_url() and handles sideloading via media_handle_sideload().
  3. Data Updation: Replaces the external URLs with local ones. For metadata, it parses nested objects and arrays using recursive string replacements and saves back serialized values correctly.
  4. Cache Busting: If Beaver Builder is active and layout modifications were made, it calls FLBuilderModel::clear_cache_for_post() and FLBuilderModel::regenerate_post_assets() to ensure the layout renders correctly with the new local images.

🛡️ License

This plugin is licensed under the GPLv2 or later.