Created
January 18, 2024 21:20
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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