PHPackages                             cloak-labs/wp-bulk-media-importer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. cloak-labs/wp-bulk-media-importer

ActiveLibrary[File &amp; Storage](/categories/file-storage)

cloak-labs/wp-bulk-media-importer
=================================

Bulk import images from external URLs to the WP Media Library.

0.0.1(1y ago)051LGPL-3.0-onlyPHP

Since Aug 27Pushed 1y agoCompare

[ Source](https://github.com/cloak-labs/wp-bulk-media-importer)[ Packagist](https://packagist.org/packages/cloak-labs/wp-bulk-media-importer)[ RSS](/packages/cloak-labs-wp-bulk-media-importer/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

WP Bulk Media Importer
======================

[](#wp-bulk-media-importer)

This is a small PHP/Composer package (intended to be used by WordPress plugin/theme developers) that provides a simple object-oriented API for importing images in bulk from external URLs referenced in a CSV file. You can also import image alt text, captions, descriptions, and hook into the upload process to import other custom stuff for each image (such as attaching each image to a taxonomy term based on a CSV value).

Most bulk media importer plugins seem to only support importing posts/pages/CPTs, with the option to import images/media as long as they're attached to the posts being imported; whereas this package simply uploads the images to the WP Media Library without requiring you to attach them to posts/pages.

**Note:** This plugin does not expose anything via the WP admin UI -- you must be somewhat comfortable with PHP to use it.

Installation
------------

[](#installation)

Require this package with Composer in the root directory of your project.

```
composer require cloak-labs/wp-bulk-media-importer
```

Usage
-----

[](#usage)

```
use CloakWP\BulkMediaImporter;

BulkMediaImporter::make()
  ->fromCsv(get_theme_file_path('/assets/images.csv'))
  ->onUpload(function ($imageId, $imageMeta) {
    /*
      Custom logic to attach each imported image to a term/category from
      the custom taxonomy `category_media`, if a valid term/category
      slug is set in the CSV's `category` column.
     */
    if (BulkMediaImporter::isMetaValid($imageMeta, 'category')) {
      $taxonomy = 'category_media';
      $term = get_term_by('slug', $imageMeta['category'], $taxonomy);
      if (!$term) return false;

      wp_set_object_terms($imageId, $term->term_id, $taxonomy);
    }
  })
  ->run(); // make sure to call `run` to actually run the import
```

It's not recommended to include the above implementation directly in `functions.php`, as you will likely end up running the import more than once. You can create a WP admin menu item that runs the import on click, or you can create a custom WP-CLI command to run it like so:

```
// in functions.php
if (defined('WP_CLI') && WP_CLI) {
  WP_CLI::add_command('bulk-media-import', function () {
    BulkMediaImporter::make()
      ->fromCsv(get_theme_file_path('/assets/images.csv'))
      ->onUpload(function ($imageId, $imageMeta) {
        if (BulkMediaImporter::isMetaValid($imageMeta, 'category')) {
          $taxonomy = 'category_media';
          $term = get_term_by('slug', $imageMeta['category'], $taxonomy);
          if (!$term) {
            WP_CLI::warning("Term not found: " . $imageMeta['category']);
            return false;
          }

          wp_set_object_terms($imageId, $term->term_id, $taxonomy);
          WP_CLI::success("Assigned category to image ID: $imageId");
        }
      })
      ->run();
  });
}
```

**Note**:

- The CSV is expected to have a `src` column referencing the external image URLs
- The CSV also expects alt text, captions, and descriptions to be under the columns `alt`, `caption`, `description`, respectively.
- Any other CSV columns will be included in `$imageMeta` as the 2nd argument to the `onUpload` method, enabling you to write custom import logic based on your custom CSV values.

Future
------

[](#future)

This package is very young and currently just supports importing from a CSV that references external image URLs; but it's intentionally architected (and named) to support other types of bulk image import scenarios in the future -- please create a new issue describing your desired import scenarios.

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

721d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5499718?v=4)[kaelan](/maintainers/kaelan)[@kaelan](https://github.com/kaelan)

---

Top Contributors

[![kaelansmith](https://avatars.githubusercontent.com/u/60372141?v=4)](https://github.com/kaelansmith "kaelansmith (3 commits)")

### Embed Badge

![Health badge](/badges/cloak-labs-wp-bulk-media-importer/health.svg)

```
[![Health](https://phpackages.com/badges/cloak-labs-wp-bulk-media-importer/health.svg)](https://phpackages.com/packages/cloak-labs-wp-bulk-media-importer)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.6k10](/packages/helsingborg-stad-municipio)[october/rain

October Rain Library

1601.7M103](/packages/october-rain)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k17.3k100](/packages/elgg-elgg)[mediawiki/maps

Adds various mapping features to MediaWiki

85155.1k3](/packages/mediawiki-maps)[civicrm/civicrm-drupal-8

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

20256.6k4](/packages/civicrm-civicrm-drupal-8)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
