https://github.com/thefrosty/wp-missed-schedule-publisher
Catches scheduled posts that have been missed and publishes them.
https://github.com/thefrosty/wp-missed-schedule-publisher
wordpress wordpress-plugin
Last synced: 4 months ago
JSON representation
Catches scheduled posts that have been missed and publishes them.
- Host: GitHub
- URL: https://github.com/thefrosty/wp-missed-schedule-publisher
- Owner: thefrosty
- License: mit
- Created: 2024-12-17T16:46:34.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-20T17:20:59.000Z (6 months ago)
- Last Synced: 2025-01-22T23:16:03.581Z (5 months ago)
- Topics: wordpress, wordpress-plugin
- Language: PHP
- Homepage: https://austin.passy.co/
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Missed Schedule Publisher
[]()
[](https://packagist.org/packages/thefrosty/wp-missed-schedule-publisher)
[](https://packagist.org/packages/thefrosty/wp-missed-schedule-publisher)
[](https://packagist.org/thefrosty/wp-missed-schedule-publisher)
Catches scheduled posts that have been missed and publishes them.
## Package Installation (via Composer)
`$ composer require thefrosty/wp-missed-schedule-publisher:^1.0`
----
### Integrations
Supports the following 3rd party plugin(s):
* [Simple History](https://wordpress.org/plugins/simple-history/) -- _log missed scheduled events and publications_
-----
- [Actions](#actions)
1. `TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher::ACTION_SCHEDULE_MISSED`
2. `TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher::ACTION_SCHEDULE_PUBLISH`- [How to use actions](#how-to-use-actions)
- When a one or more posts have missed their schedule. Example:
```php
use TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher;
add_action(MissedSchedulePublisher::ACTION_SCHEDULE_MISSED, static function(array $post_ids): void {
// Do something with the post ID's array.
});
```
- When a post that missed its schedule is published. Example:
```php
use TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher;
add_action(MissedSchedulePublisher::ACTION_SCHEDULE_PUBLISH, static function(int $post_id, false | string $old_status): void {
$new_status = get_post_status($post_id);// Maybe there was an issue publishing?
if ($old_status === $new_status) {
return;
}
// Do something with the $post_id.
});
```
- [Filters](#filters)1. `TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher::FILTER_BATCH_LIMIT`
2. `TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher::FILTER_FREQUENCY`- [How to use filters](#how-to-use-filters)
- Change the allowed batch (query) limit count. Example:
```php
use TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher;
// Lower it to only 10 (defaults to 20)
add_filter(MissedSchedulePublisher::FILTER_BATCH_LIMIT, static fn(): int => 10);
```
- Change the frequency of the check (in seconds). Example:
```php
use TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher;
// Every hour (defaults to 15 minutes)
add_filter(MissedSchedulePublisher::FILTER_FREQUENCY, static fn(): int => \HOUR_IN_SECONDS);
// Every minute (defaults to 15 minutes)
add_filter(MissedSchedulePublisher::FILTER_FREQUENCY, static fn(): int => \MINUTE_IN_SECONDS);
```