Making WordPress.org


Ignore:
Timestamp:
10/10/2019 05:38:04 PM (5 years ago)
Author:
iandunn
Message:

Official WordPress Events: Move cron jobs to init to restore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/official-wordpress-events/official-wordpress-events.php

    r9106 r9171  
    4040    public function __construct() {
    4141        add_action( 'wp_enqueue_scripts',               array( $this, 'enqueue_scripts'       ) );
     42        add_action( 'init',                             array( $this, 'schedule_cron_jobs'    ) );
    4243        add_action( 'owpe_prime_events_cache',          array( $this, 'prime_events_cache'    ) );
    4344        add_action( 'owpe_mark_deleted_meetups',        array( $this, 'mark_deleted_meetups'  ) );
     
    4546
    4647        add_shortcode( 'official_wordpress_events', array( $this, 'render_events'      ) );
    47 
     48    }
     49
     50    /**
     51     * Schedule cron jobs.
     52     *
     53     * This needs to run on the `init` action, because Cavalcade isn't fully loaded before that, and events
     54     * wouldn't be scheduled.
     55     *
     56     * @see https://dotorg.trac.wordpress.org/changeset/15351/
     57     */
     58    public function schedule_cron_jobs() {
    4859        if ( ! wp_next_scheduled( 'owpe_prime_events_cache' ) ) {
    4960            wp_schedule_event( time(), 'hourly', 'owpe_prime_events_cache' );
Note: See TracChangeset for help on using the changeset viewer.