PHP code example of thefrosty / wp-missed-schedule-publisher

1. Go to this page and download the library: Download thefrosty/wp-missed-schedule-publisher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thefrosty / wp-missed-schedule-publisher example snippets


      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.
      });
      

      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. 
      });
      

      use TheFrosty\WpMissedSchedulePublisher\WpAdmin\MissedSchedulePublisher;
      // Lower it to only 10 (defaults to 20) 
      add_filter(MissedSchedulePublisher::FILTER_BATCH_LIMIT, static fn(): int => 10);
       

      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);