PHPackages                             jmichaelward/set-post-thumbs - 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. [CLI &amp; Console](/categories/cli)
4. /
5. jmichaelward/set-post-thumbs

AbandonedArchivedWp-cli-package[CLI &amp; Console](/categories/cli)

jmichaelward/set-post-thumbs
============================

A simple WP-CLI command to query posts for their content and set the first found image as the post thumbnail.

0.1.0(5y ago)549GPL-3.0-or-laterPHP

Since Dec 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jmichaelward/set-post-thumbs)[ Packagist](https://packagist.org/packages/jmichaelward/set-post-thumbs)[ RSS](/packages/jmichaelward-set-post-thumbs/feed)WikiDiscussions main Synced 1mo ago

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

Set Post Thumbs
===============

[](#set-post-thumbs)

A simple WP-CLI command to query posts for their content and set the first found image as the post thumbnail.

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

[](#installation)

### Preferred

[](#preferred)

There are two preferred ways to install this package:

First, using WP-CLI's package installer command. Simply run `wp package install jmichaelward/set-post-thumbs`in the command line, then you're good to go.

Second, you can similarly install it using [Composer](https://getcomposer.org). In the terminal, enter:

```
composer require jmichaelward/set-post-thumbs

```

Assuming you're already using Composer's class autoloader in your WordPress project, then you can then call the function `JMichaelWard\SetPostThumbs\init_thumbnail_command()` inside an `mu-plugins` PHP file, an active plugin, or your theme's `functions.php` file.

### Alternate

[](#alternate)

Alternately, you can clone down this repository. Then, require the `set-post-thumbs.php` file relative to your file path. This will make the `JMichaelWard\SetPostThumbs\init_thumbnail_command()` method available to your project.

Usage
-----

[](#usage)

Once active, this package registers a `thumbnail` command with WP-CLI. A brief synopsis of the available subcommands is below. Please run `wp help thumbnail` to see the full set of options.

```
wp thumbnail set [--all] [--amount=] [--post_type=]

```

Without options, this will attempt to set a post thumbnail on the first 500 posts WordPress can find without a featured image. You may request that this processes on all posts by passing the `--all` flag, or a specified amount of posts by using `--amount=`. Posts are the default post type, but you can specify other post types with the `--post_type` flag.

```
wp thumbnail show  [--post_type=]

```

Passing `unset` will return a list of post IDs that were processed, but which the command was unable to set a featured image.

Passing `multiple` will return a list of post IDs that were processed and where a featured image was set, but where the posts contained multiple images in the content.

As before, passing the `--post_type` flag will query the selected post type.

```
wp thumbnail cleanup

```

This command queries all posts which have metadata generated by the above commands, then subsequently removes that metadata. I recommend running this command after assigning your featured images with this tool to clear out the unnecessary metadata, as it's primarily used for reporting with the `wp thumbnail show` command.

Extending the command
---------------------

[](#extending-the-command)

The `ThumbnailCommand` class located in the `src/` directory makes the above commands available to you. By default, the `thumbnail` command looks for images within your post content and assigns the first one it finds as the post's featured image. However, your site may have image data located in other places that you may wish to use to set as a featured image. The `ThumbnailCommand` class is designed to be extended so that you can create your own command from this scenario. The `maybe_set_featured_image` method should be your primary starting point for extension.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

1979d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/288e0a96a65ba16682ceb95ef0fa4bba1963760da477b7d266cd839d2d05b1ab?d=identicon)[jmichaelward](/maintainers/jmichaelward)

---

Top Contributors

[![jmichaelward](https://avatars.githubusercontent.com/u/1407326?v=4)](https://github.com/jmichaelward "jmichaelward (10 commits)")

### Embed Badge

![Health badge](/badges/jmichaelward-set-post-thumbs/health.svg)

```
[![Health](https://phpackages.com/badges/jmichaelward-set-post-thumbs/health.svg)](https://phpackages.com/packages/jmichaelward-set-post-thumbs)
```

###  Alternatives

[wp-cli/entity-command

Manage WordPress comments, menus, options, posts, sites, terms, and users.

1048.8M55](/packages/wp-cli-entity-command)[wp-cli/scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.

1717.7M15](/packages/wp-cli-scaffold-command)[wp-cli/i18n-command

Provides internationalization tools for WordPress projects.

11610.4M52](/packages/wp-cli-i18n-command)[wp-cli/extension-command

Manages plugins and themes, including installs, activations, and updates.

919.0M53](/packages/wp-cli-extension-command)[wp-cli/db-command

Performs basic database operations using credentials stored in wp-config.php.

768.0M30](/packages/wp-cli-db-command)[wp-cli/server-command

Launches PHP's built-in web server for a specific WordPress installation.

687.2M5](/packages/wp-cli-server-command)

PHPackages © 2026

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