Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
Created January 18, 2024 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrasguseo/bce8e5b1be8f117e6cd4763be12218a5 to your computer and use it in GitHub Desktop.
Save andrasguseo/bce8e5b1be8f117e6cd4763be12218a5 to your computer and use it in GitHub Desktop.
EA > Remove the Event URL when it's the same as the source URL
<?php
/**
* Remove the Event URL when it's the same as the source URL.
*
* When importing from OtherURL and the EventURL field is empty, it will be filled with the
* URL of the source site by default. This snippet makes sure it stays empty.
*
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets.
*
* @param array $event Event data to save
* @param object $data Importer record
*
* @return array
*
* @author: Andras Guseo
*
* Plugins required: The Events Calendar (Event Aggregator)
* Created: January 18, 2024
*/
function tec_ea_maybe_remove_eventurl( $event, $data ) {
if ( $event['EventURL'] == $data->meta['source'] ) {
$event['EventURL'] = '';
}
return $event;
}
add_filter( 'tribe_aggregator_before_save_event', 'tec_ea_maybe_remove_eventurl', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment