MSM_Sitemap_Builder_Cron::generate_sitemap_for_year PHP Method

generate_sitemap_for_year() public static method

Generate sitemap for a given year
public static generate_sitemap_for_year ( mixed[] $args )
$args mixed[]
    public static function generate_sitemap_for_year($args)
    {
        $is_partial_or_running = get_option('msm_months_to_process');
        $year = $args['year'];
        $max_month = 12;
        if ($year == date('Y')) {
            $max_month = date('n');
        }
        if (empty($is_partial_or_running)) {
            $months = range(1, $max_month);
            update_option('msm_months_to_process', $months);
        } else {
            $months = $is_partial_or_running;
        }
        $time = time();
        $next_month = end($months);
        wp_schedule_single_event($time, 'msm_cron_generate_sitemap_for_year_month', array(array('year' => (int) $year, 'month' => (int) $next_month)));
    }