wpscholar / wp-post-expiration
A WordPress module that makes it easy to add support for post expiration to any post type.
Installs: 188
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 2
Forks: 1
Open Issues: 23
Language:CSS
- dev-master
- 1.1.1
- 1.1
- 1.0
- dev-dependabot/npm_and_yarn/qs-6.4.1
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-dependabot/npm_and_yarn/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/tar-2.2.2
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-snyk-fix-a22f032cf3cb96397597f2eb289be165
- dev-snyk-fix-e1a70d56d359a7d8c778b04411ed177f
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-snyk-fix-75bc631dc4ae42405a4b5fc8618ddb5a
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-snyk-fix-60c652e796f6493795fded66276dbcac
- dev-snyk-fix-8ac16556c67ad617cbb4754aee6e68dd
- dev-dependabot/npm_and_yarn/ini-1.3.7
- dev-snyk-fix-cd2e4f53daf6a7d9d998138e180eb808
- dev-snyk-fix-2e3ba8c69cd034b5dd3ef6a40665e041
- dev-dependabot/npm_and_yarn/lodash.mergewith-4.6.2
- dev-snyk-upgrade-32c2f635c98778c3ca7ae0236223f1fb
- dev-snyk-upgrade-9228e5ef663e00e37c01d628acb49361
- dev-snyk-upgrade-b5ee519bdc2b9b4df0fb9dec0d2cc516
- dev-snyk-upgrade-9ea105b52169079b7c821618613f878d
- dev-snyk-upgrade-54417e6aa6946527b4fd0bd42c40ca36
This package is auto-updated.
Last update: 2024-11-07 14:35:28 UTC
README
A WordPress module that makes it easy to add support for post expiration to any post type.
Requirements
- PHP 5.4+
- WordPress 4.5+
Installation
Add the module to your code base via Composer
composer require wpscholar/wp-post-expiration
Initialization
If you are adding the code to a WordPress plugin or theme, there is no initialization step needed. However, if you are adding the code at a higher level in your WordPress project, you will need to call the initialization function on the init hook, like so:
add_action( 'init', 'wpscholar_post_expiration_initialize', 1000 );
Adding Post Type Support
If you are adding support to a pre-existing post type, just add this code:
add_post_type_support( 'post', 'expiration' );
Be sure to replace post
with the name of your post type.
Or, in the supports
argument when registering a post type, just add 'expiration'
.
Available Methods
The following static methods are publicly available:
setExpiration( $post_id, $expiration )
- Set expiration for a specific post. Expiration is a Unix timestamp.removeExpiration( $post_id )
- Remove expiration for a specific post.expirePost( $post_id )
- Immediately expire a specific post.expirePosts()
- Expire all posts. (Limit 100 per run per post type)