{"id":19107747,"url":"https://github.com/alleyinteractive/expiring-posts","last_synced_at":"2025-08-11T05:11:41.046Z","repository":{"id":39747505,"uuid":"464976274","full_name":"alleyinteractive/expiring-posts","owner":"alleyinteractive","description":"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).","archived":false,"fork":false,"pushed_at":"2023-12-04T17:49:42.000Z","size":390,"stargazers_count":7,"open_issues_count":4,"forks_count":1,"subscribers_count":25,"default_branch":"develop","last_synced_at":"2025-06-22T01:48:44.027Z","etag":null,"topics":["wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alleyinteractive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-01T16:42:12.000Z","updated_at":"2024-11-08T02:49:53.000Z","dependencies_parsed_at":"2025-03-12T21:41:02.255Z","dependency_job_id":null,"html_url":"https://github.com/alleyinteractive/expiring-posts","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":0.4473684210526315,"last_synced_commit":"58bda957d87791c86371f385f1c145b71fb2d2c8"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/alleyinteractive/expiring-posts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fexpiring-posts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fexpiring-posts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fexpiring-posts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fexpiring-posts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alleyinteractive","download_url":"https://codeload.github.com/alleyinteractive/expiring-posts/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alleyinteractive%2Fexpiring-posts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269832911,"owners_count":24482335,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress","wordpress-plugin"],"created_at":"2024-11-09T04:13:50.287Z","updated_at":"2025-08-11T05:11:41.022Z","avatar_url":"https://github.com/alleyinteractive.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Expiring Posts\n\nAutomatically expire posts after a certain period of time. Checks the post's\npublished and modified date to see if the post is expired and will perform an\naction on the post (draft/trash/delete it).\n\n## Usage\n\n### Registering Post Types\n\nPosts that are expired can be made into `draft` or `trash` posts or outright\ndeleted.\n\n#### Register a post type to be drafted after a month\n\n```php\nexpiring_posts_add_post_type(\n\t$post_type,\n\t[\n\t\t'action'       =\u003e 'draft',\n\t\t'expire_after' =\u003e MONTH_IN_SECONDS,\n\t],\n);\n```\n\n#### Register a post type to be trashed after a week\n\n```php\nexpiring_posts_add_post_type(\n\t$post_type,\n\t[\n\t\t'action'       =\u003e 'trash',\n\t\t'expire_after' =\u003e WEEK_IN_SECONDS,\n\t],\n);\n```\n\n#### Register a post type to be deleted after a week\n\n```php\nexpiring_posts_add_post_type(\n\t$post_type,\n\t[\n\t\t'action'       =\u003e 'delete',\n\t\t'expire_after' =\u003e WEEK_IN_SECONDS,\n\t],\n);\n```\n\n#### Register a post type to be updated after a week\n\n```php\nexpiring_posts_add_post_type(\n\t$post_type,\n\t[\n\t\t'action'       =\u003e 'update',\n\t\t'expire_after' =\u003e WEEK_IN_SECONDS,\n\t\t'update_args'  =\u003e [\n\t\t\t'meta_input' =\u003e [\n\t\t\t\t'key' =\u003e 'value',\n\t\t\t],\n\t\t],\n\t],\n);\n\n// Or use a callback to define the arguments. The callback\n// is passed an instance of WP_Post.\nexpiring_posts_add_post_type(\n\t$post_type,\n\t[\n\t\t'action'       =\u003e 'update',\n\t\t'expire_after' =\u003e WEEK_IN_SECONDS,\n\t\t'update_args'  =\u003e fn ( WP_Post $post ) =\u003e [\n\t\t\t'post_title' =\u003e 'Expired: ' . $post-\u003epost_title,\n\t\t],\n\t],\n);\n```\n\nBy default, the post type will be set to be drafted after a year.\n\n### Hooks\n\n#### `expiring_posts_is_post_expired`\n\nFilter applied to check if a post is expired.\n\nProps:\n\n- `$is_expired`: `bool`  Whether the post is expired.\n- `$post`: `WP_Post` Post to check.\n- `$threshold`: `int`  Threshold to check against (unix timestamp).\n- `$now`: `int` Current timestamp.\n\n#### `expiring_posts_cron_interval`\n\nInterval to run the expiration check. Defaults to every hour.\n\n#### `expiring_posts_expired`\n\nAction fired when a post was expired.\n\nProps:\n\n- `$post_id`: `int` Post ID\n- `$post`: `WP_Post` Post object.\n\n#### `expiring_posts_query_args`\n\nFilter applied to the query arguments used to find expired posts.\n\nProps:\n\n- `$args`: `array` Query arguments.\n- `$now`: `int` Current timestamp.\n\n### Unregister a post type\n\n```php\nexpiring_posts_remove_post_type( $post_type );\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## License\n\nReleased under the [GPL\nv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falleyinteractive%2Fexpiring-posts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falleyinteractive%2Fexpiring-posts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falleyinteractive%2Fexpiring-posts/lists"}