When using the WordPress plugin The Events Calendar by Modern Tribe the default link in the calendar will point to the Event page. However, sometimes we want to point this link somewhere else.
When creating the event you can add an Event Website
. In my case, the Event Website is what I want to use in place of the default link.
The following code will replace the default event link with the Event Website link. If the Event Website link is not set, the original default event link will still be used.
// From https://salferrarello.com/modern-tribe-events-calendar-replace-default-event-link-with-event-website.
add_filter( 'tribe_get_event_link', function( $link, $post_id, $full_link, $url ) {
$event_url = tribe_get_event_meta( $post_id, '_EventURL', true );
return $event_url ?: $link;
}, 10, 4 );
Hi Sal
Thanks for putting this up.
I tried it and it retrieved the event link but doesn’t assign it to the event in the calendar.
Am I missing something?