Download the PHP package alleyinteractive/expiring-posts without Composer
On this page you can find all versions of the php package alleyinteractive/expiring-posts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alleyinteractive/expiring-posts
More information about alleyinteractive/expiring-posts
Files in alleyinteractive/expiring-posts
Package expiring-posts
Short Description Automatically Expire Posts
License GPL-2.0-or-later
Informations about the package 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
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 trashed after a week
Register a post type to be deleted after a week
Register a post type to be updated after a week
By default, the post type will be set to be drafted after a year.
Hooks
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
Interval to run the expiration check. Defaults to every hour.
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
Filter applied to the query arguments used to find expired posts.
Props:
$args
:array
Query arguments.$now
:int
Current timestamp.
Unregister a post type
Testing
License
Released under the GPL v2 license.