Home › Forums › Calendar Products › Event Aggregator › Adding categories to event on import
- This topic has 4 replies, 3 voices, and was last updated 8 years, 2 months ago by Support Droid.
-
AuthorPosts
-
November 4, 2015 at 11:28 am #1021813JasonParticipant
Hi Support,
This is a follow up to https://theeventscalendar.com/support/forums/topic/set-default-organizer-categories-tags-per-imported-feed/. I’m attempting to add additional categories to events of an ical import other than the 1 category allowed through the ical import interface.I’m adding the following code:
add_action( ‘tribe_events_update_meta’, ‘set_default_event_meta’);
function set_default_event_meta ( $event_id ) {
wp_set_object_terms($event_id, array(‘student’), ‘tribe_events_cat’ );
}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:
wp_set_object_terms( $event[‘ID’], $terms, Tribe__Events__Main::TAXONOMY, false );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…then it would append the category rather than wipe them out.
November 4, 2015 at 8:29 pm #1021993CliffMemberHi Jason. Thanks for your detailed question.
Have you tried editing that line of /wp-content/plugins/the-events-calendar-importer-ical/src/Tribe/Importer.php and seeing if changing
false
totrue
does work as desired?November 5, 2015 at 6:33 am #1022132JasonParticipantYes, I changed the false to true and it worked great. I was able to use the code to add the additional categories. Is this something that can be changed in the core code?
November 6, 2015 at 1:49 am #1022458CliffMemberThanks for confirming that worked for you.
I passed the idea along to our developers and they agreed making that filterable would be ok. So the best I can say now is that it likely might come in a future release.
Thanks for helping make our plugins better!
February 18, 2016 at 8:30 am #1075448Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Adding categories to event on import’ is closed to new replies.