PHPackages                             alleyinteractive/expiring-posts - 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. alleyinteractive/expiring-posts

ActiveWordpress-plugin

alleyinteractive/expiring-posts
===============================

Automatically Expire Posts

v0.3.0(8mo ago)76.2k↓80.9%[2 PRs](https://github.com/alleyinteractive/expiring-posts/pulls)GPL-2.0-or-laterPHPCI passing

Since Mar 2Pushed 8mo ago23 watchersCompare

[ Source](https://github.com/alleyinteractive/expiring-posts)[ Packagist](https://packagist.org/packages/alleyinteractive/expiring-posts)[ RSS](/packages/alleyinteractive-expiring-posts/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (8)Used By (0)

Expiring Posts
==============

[](#expiring-posts)

Automatically expire posts after a certain period of time. Checks the post's published and modified date to see if the post is expired and will perform an action on the post (draft/trash/delete it).

Usage
-----

[](#usage)

### Registering Post Types

[](#registering-post-types)

Posts that are expired can be made into `draft` or `trash` posts or outright deleted.

#### Register a post type to be drafted after a month

[](#register-a-post-type-to-be-drafted-after-a-month)

```
expiring_posts_add_post_type(
	$post_type,
	[
		'action'       => 'draft',
		'expire_after' => MONTH_IN_SECONDS,
	],
);
```

#### Register a post type to be trashed after a week

[](#register-a-post-type-to-be-trashed-after-a-week)

```
expiring_posts_add_post_type(
	$post_type,
	[
		'action'       => 'trash',
		'expire_after' => WEEK_IN_SECONDS,
	],
);
```

#### Register a post type to be deleted after a week

[](#register-a-post-type-to-be-deleted-after-a-week)

```
expiring_posts_add_post_type(
	$post_type,
	[
		'action'       => 'delete',
		'expire_after' => WEEK_IN_SECONDS,
	],
);
```

#### Register a post type to be updated after a week

[](#register-a-post-type-to-be-updated-after-a-week)

```
expiring_posts_add_post_type(
	$post_type,
	[
		'action'       => 'update',
		'expire_after' => WEEK_IN_SECONDS,
		'update_args'  => [
			'meta_input' => [
				'key' => 'value',
			],
		],
	],
);

// Or use a callback to define the arguments. The callback
// is passed an instance of WP_Post.
expiring_posts_add_post_type(
	$post_type,
	[
		'action'       => 'update',
		'expire_after' => WEEK_IN_SECONDS,
		'update_args'  => fn ( WP_Post $post ) => [
			'post_title' => 'Expired: ' . $post->post_title,
		],
	],
);
```

By default, the post type will be set to be drafted after a year.

### Hooks

[](#hooks)

#### `expiring_posts_is_post_expired`

[](#expiring_posts_is_post_expired)

Filter applied to check if a post is expired.

Props:

- `$is_expired`: `bool` Whether the post is expired.
- `$post`: `WP_Post` Post to check.
- `$threshold`: `int` Threshold to check against (unix timestamp).
- `$now`: `int` Current timestamp.

#### `expiring_posts_cron_interval`

[](#expiring_posts_cron_interval)

Interval to run the expiration check. Defaults to every hour.

#### `expiring_posts_expired`

[](#expiring_posts_expired)

Action fired when a post was expired.

Props:

- `$post_id`: `int` Post ID
- `$post`: `WP_Post` Post object.

#### `expiring_posts_query_args`

[](#expiring_posts_query_args)

Filter applied to the query arguments used to find expired posts.

Props:

- `$args`: `array` Query arguments.
- `$now`: `int` Current timestamp.

### Unregister a post type

[](#unregister-a-post-type)

```
expiring_posts_remove_post_type( $post_type );
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

Released under the [GPL v2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) license.

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance65

Regular maintenance activity

Popularity28

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.3% 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

Every ~427 days

Total

4

Last Release

246d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/338d27065b1074f2d66d049d742f22996dd137eef6f91bc8f75350ceee1e8ef2?d=identicon)[srtfisher](/maintainers/srtfisher)

---

Top Contributors

[![srtfisher](https://avatars.githubusercontent.com/u/346399?v=4)](https://github.com/srtfisher "srtfisher (46 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (10 commits)")[![dlh01](https://avatars.githubusercontent.com/u/697432?v=4)](https://github.com/dlh01 "dlh01 (5 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (4 commits)")

---

Tags

wordpresswordpress-plugin

### Embed Badge

![Health badge](/badges/alleyinteractive-expiring-posts/health.svg)

```
[![Health](https://phpackages.com/badges/alleyinteractive-expiring-posts/health.svg)](https://phpackages.com/packages/alleyinteractive-expiring-posts)
```

PHPackages © 2026

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