{"id":250,"date":"2021-09-05T09:43:08","date_gmt":"2021-09-05T09:43:08","guid":{"rendered":"https:\/\/utillz.com\/docs\/brikk\/?p=250"},"modified":"2021-11-22T06:32:40","modified_gmt":"2021-11-22T06:32:40","slug":"use-custom-period-for-icalendar-synchronization","status":"publish","type":"post","link":"https:\/\/utillz.com\/docs\/brikk\/use-custom-period-for-icalendar-synchronization\/","title":{"rendered":"Use custom period for iCalendar synchronization"},"content":{"rendered":"<p>The minimum recurrence by default is &#8216;hourly&#8217;.\u00c2\u00a0You can easily add a new interval schedule by doing the following using the\u00c2\u00a0<a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_get_schedules\/\" target=\"_blank\" rel=\"nofollow noreferrer noopener\">\u00e2\u20ac\u02dccron_schedules\u00e2\u20ac\u2122 filter<\/a>.<\/p>\n<h3 id=\"add-custom-schedules\">Add custom schedules<\/h3>\n<p>The following example will fire the cron job every 15 minutes:<\/p>\n<pre class=\"hljs php\">add_filter( <span class=\"hljs-string\">'cron_schedules'<\/span>, <span class=\"hljs-string\">'cron_add_15_min'<\/span> );\r\n \r\n<span class=\"hljs-function\"><span class=\"hljs-keyword\">function<\/span> <span class=\"hljs-title\">cron_add_15_min<\/span><span class=\"hljs-params\">( $schedules )<\/span> <\/span>{\r\n   <span class=\"hljs-comment\">\/\/ Adds to the existing schedules.<\/span>\r\n   $schedules[<span class=\"hljs-string\">'15_min'<\/span>] = <span class=\"hljs-keyword\">array<\/span>(\r\n       <span class=\"hljs-string\">'interval'<\/span> =&#x3e; <span class=\"hljs-number\">900<\/span>,\r\n       <span class=\"hljs-string\">'display'<\/span> =&#x3e; __( <span class=\"hljs-string\">'Once Every 15 Min'<\/span> )\r\n   );\r\n   <span class=\"hljs-keyword\">return<\/span> $schedules;\r\n}\r\n<\/pre>\n<h3 id=\"change-the-schedule\">Change the schedule<\/h3>\n<p>You can find the scheduled event in <strong>\\routiz\\inc\\src\\install.php<\/strong><\/p>\n<p>Then find the following line of code:<\/p>\n<pre>wp_schedule_event( time(), 'hourly', 'routiz_scheduled_ical_sync' );<\/pre>\n<p>and replace it with:<\/p>\n<pre>wp_schedule_event( time(), '<span class=\"hljs-string\">cron_add_15_min<\/span>', 'routiz_scheduled_ical_sync' );<\/pre>\n<p>Save the changes and go to your Plugins. Deactivate Routiz and activate it back again in order to flush the scheduled events.<\/p>\n<h3 id=\"faq\">FAQ<\/h3>\n<p><strong>Can I debug cron jobs?<\/strong> \u00e2\u20ac\u201d Yes, you can use <a href=\"https:\/\/wordpress.org\/plugins\/wp-crontrol\/\" target=\"_blank\" rel=\"nofollow noreferrer noopener\">this plugin<\/a> to debug the scheduled crons.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The minimum recurrence by default is &#8216;hourly&#8217;.\u00c2\u00a0You can easily add a new interval schedule by doing the following using the\u00c2\u00a0\u00e2\u20ac\u02dccron_schedules\u00e2\u20ac\u2122 filter. Add custom schedules The &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/posts\/250"}],"collection":[{"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/comments?post=250"}],"version-history":[{"count":0,"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/posts\/250\/revisions"}],"wp:attachment":[{"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/media?parent=250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/categories?post=250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/utillz.com\/docs\/brikk\/wp-json\/wp\/v2\/tags?post=250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}