Hey Ryan,
Thanks for reaching out!
I’m sorry to bear this news, but at this time there is no such method for determining if an event was imported from iCal or not.
There is one other function or approach here that would work. It’s still a bit “hacky”, but much less so than your current solution—I don’t say this to knock your current solution, because it’s in fact really clever and well done. I only mention it being less “hacky” because this should hopefully be appealing as a more long-term solution.
On to the solution itself—which is essentially just looking for a meta key on the event called “_uid”. So if you have events you can check for this with something like this:
foreach( $events as $event ) {
// Get the event post meta.
// It's possible in numerous ways, this is just an example.
$event_id = $event->ID;
$post_meta = get_post_meta( $event_id );
// Now look for the _uid key.
if ( isset( $post_meta['_uid'] ) ) {
// This is has a UID, and so is from iCal importer.
} else {
// No UID, thus likely not from iCal importer.
}
}
☝️ Tinker around with this and let us know if it helps!
Cheers,
George