PHPackages                             alleyinteractive/wp-bulk-task - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. alleyinteractive/wp-bulk-task

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alleyinteractive/wp-bulk-task
=============================

A library to assist with running performant bulk tasks against WordPress objects.

v1.1.0(10mo ago)21326.8k—8.5%1[1 issues](https://github.com/alleyinteractive/wp-bulk-task/issues)[1 PRs](https://github.com/alleyinteractive/wp-bulk-task/pulls)3GPL-2.0-or-laterPHPPHP &gt;=8.1

Since Nov 16Pushed 10mo ago26 watchersCompare

[ Source](https://github.com/alleyinteractive/wp-bulk-task)[ Packagist](https://packagist.org/packages/alleyinteractive/wp-bulk-task)[ RSS](/packages/alleyinteractive-wp-bulk-task/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (13)Used By (3)

WP Bulk Task
============

[](#wp-bulk-task)

[![Readme Standard Spec Badge](https://camo.githubusercontent.com/4d148b38f9c13f71b15b80f0bd583698fd5a5ab9bd7dfe61d40e1e30aec35399/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f726561646d652532307374796c652d7374616e646172642d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/RichardLitt/standard-readme)

A library to assist with running performant bulk tasks against WordPress objects.

Background
----------

[](#background)

This package provides a library to make it easier to run bulk tasks against a WordPress database in a performant way. It includes functionality to search through a WordPress database for posts, terms, and users, and using WP\_Query-style arguments and keeps a cursor of its location within the database in case it is interrupted and needs to start again.

Releases
--------

[](#releases)

This package is released via Packagist for installation via Composer. It follows semantic versioning conventions.

### Install

[](#install)

Requires Composer and PHP &gt;= `8.1`.

### Use

[](#use)

Install this package via Composer:

```
composer require alleyinteractive/wp-bulk-task
```

Ensure that the Composer autoloader is loaded into your project:

```
require_once __DIR__ . '/vendor/autoload.php';
```

Then use the class in your custom CLI command:

```
class My_Custom_CLI_Command extends WP_CLI_Command {
	use Bulk_Task_Side_Effects;

	/**
	 * Replace all instances of 'apple' with 'banana' in post content.
	 *
	 * ## OPTIONS
	 *
	 * [--dry-run]
	 * : If present, no updates will be made.
	 *
	 * [--rewind]
	 * : Resets the cursor so the next time the command is run it will start from the beginning.
	 *
	 * ## EXAMPLES
	 *
	 *     # Bananaify links.
	 *     $ wp my-custom-cli-command bananaify
	 */
	public function bananaify( $args, $assoc_args ) {
		$bulk_task = new \Alley\WP_Bulk_Task\Bulk_Task(
			'bananaify',
			new \Alley\WP_Bulk_Task\Progress\PHP_CLI_Progress_Bar(
				__( 'Bulk Task: remove_broken_links', 'my-textdomain' )
			)
		);

		// Handle rewind requests.
		if ( ! empty( $assoc_args['rewind'] ) ) {
			$bulk_task->cursor->reset();
			WP_CLI::log( __( 'Rewound the cursor. Run again without the --rewind flag to process posts.', 'my-textdomain' ) );
			return;
		}

		$this->pause_side_effects();

		// Set up and run the bulk task.
		$dry_run = ! empty( $assoc_args['dry-run'] );
		$bulk_task->run(
			[
				'post_status' => 'publish',
				'post_type'   => 'post',
				'tax_query'   => [
					[
						'field'    => 'slug',
						'taxonomy' => 'category',
						'terms'    => 'fruit',
					],
				],
			],
			function( $post ) use ( $dry_run ) {
				if ( false !== strpos( $post->post_content, 'apple' ) ) {
					$new_value = str_replace( 'apple', 'banana', $post->post_content );
					if ( $dry_run ) {
						WP_CLI::log( 'Old post_content: ' . $post->post_content );
						WP_CLI::log( 'New post_content: ' . $new_value );
					} else {
						$post->post_content = $new_value;
						wp_update_post( $post );
					}
				}
			}
		);

		$this->resume_side_effects();
	}
}
```

For more information on usage, [visit the wiki](https://github.com/alleyinteractive/wp-bulk-task/wiki).

### From Source

[](#from-source)

To work on this project locally, first add the repository to your project's `composer.json`:

```
{
	"repositories": [
		{
			"type": "path",
			"url": "../path/to/wp-bulk-task",
			"options": {
				"symlink": true
			}
		}
	]
}
```

Next, add the local development files to the `require` section of `composer.json`:

```
{
	"require": {
		"alleyinteractive/wp-bulk-task": "@dev"
	}
}
```

Finally, update composer to use the local copy of the package:

```
composer update alleyinteractive/wp-bulk-task --prefer-source
```

### Changelog

[](#changelog)

This project keeps a [changelog](CHANGELOG.md).

Development Process
-------------------

[](#development-process)

See instructions above on installing from source. Pull requests are welcome from the community and will be considered for inclusion. Releases follow semantic versioning and are shipped on an as-needed basis.

### Contributing

[](#contributing)

See [our contributor guidelines](CONTRIBUTING.md) for instructions on how to contribute to this open source project.

Project Structure
-----------------

[](#project-structure)

This is a Composer package that is published to [Packagist](https://packagist.org/).

Classes must be autoloadable using `alleyinteractive/composer-wordpress-autoloader` and live in the `src`directory, following standard WordPress naming conventions for classes.

Related Efforts
---------------

[](#related-efforts)

- [WP\_CLI](https://github.com/wp-cli/wp-cli)

Maintainers
-----------

[](#maintainers)

- [Alley](https://github.com/alleyinteractive)

[![Alley logo](https://avatars.githubusercontent.com/u/1733454?s=200&v=4)](https://avatars.githubusercontent.com/u/1733454?s=200&v=4)

### Contributors

[](#contributors)

Thanks to all of the [contributors](CONTRIBUTORS.md) to this project.

License
-------

[](#license)

This project is licensed under the [GNU Public License (GPL) version 2](LICENSE) or later.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance53

Moderate activity, may be stable

Popularity44

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~97 days

Recently: every ~116 days

Total

11

Last Release

305d ago

Major Versions

v0.3.0 → v1.0.02024-08-13

v1.0.0 → 2.x-dev2025-06-11

PHP version history (2 changes)v0.1.0PHP &gt;=8.0

v1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2679da8ee30c4d7eae16ffd2271484027b3b27be6d7fb8202d5e4c6d210881d?d=identicon)[alleyinteractive](/maintainers/alleyinteractive)

---

Top Contributors

[![renatonascalves](https://avatars.githubusercontent.com/u/19148962?v=4)](https://github.com/renatonascalves "renatonascalves (47 commits)")[![kevinfodness](https://avatars.githubusercontent.com/u/2650828?v=4)](https://github.com/kevinfodness "kevinfodness (38 commits)")[![srtfisher](https://avatars.githubusercontent.com/u/346399?v=4)](https://github.com/srtfisher "srtfisher (12 commits)")[![emilyatmobtown](https://avatars.githubusercontent.com/u/24902269?v=4)](https://github.com/emilyatmobtown "emilyatmobtown (7 commits)")[![dlh01](https://avatars.githubusercontent.com/u/697432?v=4)](https://github.com/dlh01 "dlh01 (5 commits)")[![mslinnea](https://avatars.githubusercontent.com/u/7308162?v=4)](https://github.com/mslinnea "mslinnea (2 commits)")[![mogmarsh](https://avatars.githubusercontent.com/u/11542164?v=4)](https://github.com/mogmarsh "mogmarsh (2 commits)")[![nlemoine](https://avatars.githubusercontent.com/u/2526939?v=4)](https://github.com/nlemoine "nlemoine (1 commits)")

---

Tags

wordpress

### Embed Badge

![Health badge](/badges/alleyinteractive-wp-bulk-task/health.svg)

```
[![Health](https://phpackages.com/badges/alleyinteractive-wp-bulk-task/health.svg)](https://phpackages.com/packages/alleyinteractive-wp-bulk-task)
```

###  Alternatives

[alleyinteractive/wp-block-converter

Convert HTML into Gutenberg Blocks with PHP

62321.0k1](/packages/alleyinteractive-wp-block-converter)[alleyinteractive/wp-alleyvate

Defaults for WordPress sites by Alley.

3434.2k](/packages/alleyinteractive-wp-alleyvate)[alleyinteractive/wp-curate

Plugin to curate homepages and other landing pages

10154.3k](/packages/alleyinteractive-wp-curate)[alleyinteractive/feed-consumer

Ingest external feeds and other data sources into WordPress

114.8k](/packages/alleyinteractive-feed-consumer)

PHPackages © 2026

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