Skip to content

Instantly share code, notes, and snippets.

@skyshab
Created September 24, 2018 15:07
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 skyshab/d5c063f32ef3d95359082a542555a3bd to your computer and use it in GitHub Desktop.
Save skyshab/d5c063f32ef3d95359082a542555a3bd to your computer and use it in GitHub Desktop.
Redirect event links to Eventbrite.com
<?php
/*
* This changes the event link to the Eventbrite URL if that is set.
*/
add_filter( 'tribe_get_event_link', 'my_set_eb_link', 100, 2 );
function my_set_eb_link ( $link, $postId ) {
$eventbrite_id = get_post_meta( $postId, '_EventBriteId', true );
// Only swaps link if set
if ( !empty( $eventbrite_id ) ) {
$link = 'https://www.eventbrite.com/edit?eid=' . $eventbrite_id;
}
return $link;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment