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 2d 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

21

—

LowBetter than 18% of packages

Maintenance33

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

676d 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.5k10](/packages/helsingborg-stad-municipio)[october/rain

October Rain Library

1601.7M83](/packages/october-rain)[deliciousbrains/wp-amazon-s3-and-cloudfront

Automatically copies media uploads to a storage provider's bucket for delivery. Optionally configure a CDN for even faster delivery.

312214.5k1](/packages/deliciousbrains-wp-amazon-s3-and-cloudfront)[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.

45444.2k1](/packages/pressbooks-pressbooks)[humanmade/network-media-library

Network Media Library provides a central media library that's shared across all sites on the Multisite network.

29745.6k](/packages/humanmade-network-media-library)[mediawiki/maps

Adds various mapping features to MediaWiki

84152.3k3](/packages/mediawiki-maps)

PHPackages © 2026

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