Changeset 47062
- Timestamp:
- 01/12/2020 11:18:03 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/cron.php
r47060 r47062 784 784 * Retrieve supported event recurrence schedules. 785 785 * 786 * The default supported recurrences are 'hourly', 'twicedaily', and 'daily'. A plugin may787 * add more by hooking into the {@see 'cron_schedules'} filter. The filter accepts an array788 * of arrays. The outer array has a key that is the name of the schedule or for789 * example 'weekly'. The value is an array with two keys, one is 'interval' and790 * the other is 'display'.791 * 792 * The 'interval' is a number in seconds of when the cron job should run. So for793 * 'hourly', the time is 3600 or 60*60. For weekly, the value would be794 * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.795 * 796 * The 'display' is the description. For the ' weekly' key, the 'display' would797 * be `__( 'Once Weekly' )`.798 * 799 * For your plugin, you will be passed an array. you can easily add your786 * The default supported recurrences are 'hourly', 'twicedaily', 'daily', and 'weekly'. 787 * A plugin may add more by hooking into the {@see 'cron_schedules'} filter. 788 * The filter accepts an array of arrays. The outer array has a key that is the name 789 * of the schedule, for example 'monthly'. The value is an array with two keys, 790 * one is 'interval' and the other is 'display'. 791 * 792 * The 'interval' is a number in seconds of when the cron job should run. 793 * So for 'hourly' the time is `HOUR_IN_SECONDS` (60 * 60 or 3600). For 'monthly', 794 * the value would be `MONTH_IN_SECONDS` (30 * 24 * 60 * 60 or 2592000). 795 * 796 * The 'display' is the description. For the 'monthly' key, the 'display' 797 * would be `__( 'Once Monthly' )`. 798 * 799 * For your plugin, you will be passed an array. You can easily add your 800 800 * schedule by doing the following. 801 801 * 802 802 * // Filter parameter variable name is 'array'. 803 * $array[' weekly'] = array(804 * 'interval' => 604800,805 * 'display' => __( 'Once Weekly' )803 * $array['monthly'] = array( 804 * 'interval' => MONTH_IN_SECONDS, 805 * 'display' => __( 'Once Monthly' ) 806 806 * ); 807 807 * 808 808 * @since 2.1.0 809 * @since 5.4.0 The 'weekly' schedule was added. 809 810 * 810 811 * @return array … … 824 825 'display' => __( 'Once Daily' ), 825 826 ), 827 'weekly' => array( 828 'interval' => 7 * DAY_IN_SECONDS, 829 'display' => __( 'Once Weekly' ), 830 ), 826 831 ); 832 827 833 /** 828 834 * Filters the non-default cron schedules.
Note: See TracChangeset
for help on using the changeset viewer.