=== Auto Post Expiry Manager ===
Contributors: hardik2104  
Tags: expire posts, post expiration, auto unpublish, post lifecycle, schedule post draft  
Requires at least: 5.0  
Tested up to: 6.8  
Requires PHP: 7.2  
Stable tag: 1.0  
License: GPLv2 or later  
License URI: https://www.gnu.org/licenses/gpl-2.0.html    

Automatically expire posts and custom post types at a specific date and time. Works with all public post types and uses a lightweight cron scheduler.

== Description ==

**Auto Post Expiry Manager** allows you to set an expiry date and time for any post or custom post type. Once the scheduled expiry time is reached, the post will automatically switch from "Published" to "Draft" status.

It's useful for:
- Event announcements
- Time-sensitive promotions
- Auto-drafting outdated posts
- Limiting visibility on dated content

**Key Features:**
- Works with **all public post types**
- Set expiration time using a simple **datetime picker**
- Lightweight cron job runs every minute
- Automatically removes expiry after execution
- Manual trigger available via URL for testing

== Installation ==

1. Upload the plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. Edit any post or custom post type. Use the **"Expiry Date & Time"** box in the sidebar to set when it should expire.
4. That's it! The post will be drafted automatically at the scheduled time.

== Screenshots ==

1. Post edit screen with expiry date and time field.
2. Auto-drafting of the post after expiry.

== Frequently Asked Questions ==

= Will this work for custom post types? =  
Yes, it works for all **public** post types.

= What happens to the post after expiry? =  
The post status is changed to **Draft** and the expiry field is cleared.

= Can I manually trigger the expiry check? =  
Yes. You can run `yoursite.com/wp-admin/?force_expire=1` as an admin to manually check and expire posts.

= Does it use WP Cron? =  
Yes, a custom event is scheduled to run every minute using `wp_schedule_event()`.

== Changelog ==

= 1.0 =
* Initial release of Auto Post Expiry Manager.

== Upgrade Notice ==

= 1.0 =
First stable version.

== License ==

This plugin is licensed under the [GPLv2 or later](https://www.gnu.org/licenses/gpl-2.0.html).  
Copyright (c) 2025 Hardik Galiya
