• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Solution / Modern Tribe Events Calendar Replace Default Event Link with Event Website

Modern Tribe Events Calendar Replace Default Event Link with Event Website

Last updated on August 23, 2019 by Sal Ferrarello

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 );
Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Draft, Programming, Solution Tagged With: The Events Calendar, WordPress Plugin

Reader Interactions

Comments

  1. Neil Turner says

    November 15, 2022 at 12:28 pm

    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?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in