{"id":1021813,"date":"2015-11-04T11:28:20","date_gmt":"2015-11-04T19:28:20","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/"},"modified":"2016-02-18T08:30:53","modified_gmt":"2016-02-18T16:30:53","slug":"adding-categories-to-event-on-import","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/","title":{"rendered":"Adding categories to event on import"},"content":{"rendered":"<p>Hi Support,<br \/>\nThis is a follow up to https:\/\/theeventscalendar.com\/support\/forums\/topic\/set-default-organizer-categories-tags-per-imported-feed\/.  I&#8217;m attempting to add additional categories to events of an ical import other than the 1 category allowed through the ical import interface.  <\/p>\n<p>I&#8217;m adding the following code:<br \/>\nadd_action( &#8216;tribe_events_update_meta&#8217;, &#8216;set_default_event_meta&#8217;);<br \/>\nfunction set_default_event_meta ( $event_id ) {<br \/>\n    wp_set_object_terms($event_id, array(&#8216;student&#8217;), &#8216;tribe_events_cat&#8217; );<br \/>\n}<\/p>\n<p>This works great but unfortunately the code within your plugin wipes out any categories that I apply in this method.  Line 473 of importer.php in the ical importer add on has:<br \/>\nwp_set_object_terms( $event[&#8216;ID&#8217;], $terms, Tribe__Events__Main::TAXONOMY, false );<\/p>\n<p>The last parameter false says replace whatever categories are there with the category defined on the import interface.  This wipes out the student category I was trying to add even if there are none defined in the interface.  Could this last parameter be changed to be true&#8230;then it would append the category rather than wipe them out.<\/p>\n","protected":false},"template":"","class_list":["post-1021813","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding categories to event on import -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding categories to event on import -\" \/>\n<meta property=\"og:description\" content=\"Hi Support, This is a follow up to https:\/\/theeventscalendar.com\/support\/forums\/topic\/set-default-organizer-categories-tags-per-imported-feed\/. I&#8217;m attempting to add additional categories to events of an ical import other than the 1 category allowed through the ical import interface. I&#8217;m adding the following code: add_action( &#8216;tribe_events_update_meta&#8217;, &#8216;set_default_event_meta&#8217;); function set_default_event_meta ( $event_id ) { wp_set_object_terms($event_id, array(&#8216;student&#8217;), &#8216;tribe_events_cat&#8217; ); } This works great but [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-02-18T16:30:53+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/\",\"name\":\"Adding categories to event on import -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-11-04T19:28:20+00:00\",\"dateModified\":\"2016-02-18T16:30:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Event Aggregator\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/event-aggregator\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Adding categories to event on import\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding categories to event on import -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/","og_locale":"en_US","og_type":"article","og_title":"Adding categories to event on import -","og_description":"Hi Support, This is a follow up to https:\/\/theeventscalendar.com\/support\/forums\/topic\/set-default-organizer-categories-tags-per-imported-feed\/. I&#8217;m attempting to add additional categories to events of an ical import other than the 1 category allowed through the ical import interface. I&#8217;m adding the following code: add_action( &#8216;tribe_events_update_meta&#8217;, &#8216;set_default_event_meta&#8217;); function set_default_event_meta ( $event_id ) { wp_set_object_terms($event_id, array(&#8216;student&#8217;), &#8216;tribe_events_cat&#8217; ); } This works great but [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/","article_modified_time":"2016-02-18T16:30:53+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/","name":"Adding categories to event on import -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-11-04T19:28:20+00:00","dateModified":"2016-02-18T16:30:53+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/adding-categories-to-event-on-import\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Event Aggregator","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/event-aggregator\/"},{"@type":"ListItem","position":5,"name":"Adding categories to event on import"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1021813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1021813\/revisions"}],"predecessor-version":[{"id":1021992,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1021813\/revisions\/1021992"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1021813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}