{"id":7217223,"date":"2016-03-29T07:23:40","date_gmt":"2016-03-29T07:23:40","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/adding-events-through-code\/"},"modified":"2016-08-31T15:12:13","modified_gmt":"2016-08-31T15:12:13","slug":"adding-events-through-code","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/adding-events-through-code\/","title":{"rendered":"Adding events through code"},"content":{"rendered":"<p>Hi,<br \/>\nI need to add some event manually through php and I found this:<\/p>\n<pre><code>$EM_Event = new EM_Event();\n$EM_Event-&gt;event_name = $evt_name;\n$EM_Event-&gt;event_start_date = $evt_start_d;\n$EM_Event-&gt;event_start_time = $evt_start_t;\n$EM_Event-&gt;event_end_date = $evt_end_d;\n$EM_Event-&gt;event_end_time = $evt_end_t;\n$EM_Event-&gt;start = strtotime($EM_Event-&gt;event_start_date.&quot; &quot;.$EM_Event-&gt;event_start_time);\n\n$EM_Event-&gt;end = strtotime($EM_Event-&gt;event_end_date.&quot; &quot;.$EM_Event-&gt;event_end_time);\n$EM_Event-&gt;event_all_day = $evt_all_day;\n$EM_Event-&gt;recurrence = $evt_rec;\n$EM_Event-&gt;recurrence_freq = $evt_rec_freq;\n$EM_Event-&gt;recurrence_interval = $evt_rec_int;\n$EM_Event-&gt;recurrence_byweekno = $evt_rec_weekno;\n$EM_Event-&gt;recurrence_byday = 3;\/\/$evt_rec_byday;\n$EM_Event-&gt;recurrence_days = 0;\/\/$evt_rec_days;\n$EM_Event-&gt;save();<\/code><\/pre>\n<p>This seems that it doesn&#8217;t work because I don&#8217;t find new events added manually.<\/p>\n<p>Can someone help me to understand where I wrong?<\/p>\n<p>Thank you<\/p>\n<p>https:\/\/wordpress.org\/plugins\/events-manager\/<\/p>\n","protected":false},"template":"","class_list":["post-7217223","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7217223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/7217223\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=7217223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}