Search code examples
phpwordpresseventbrite

Get Eventbrite page URL from Event ID


I have several event IDs from Eventbrite, e.g. 707852093667, from which I'm trying to extract a permalink in a WordPress template, leading to the event's page at Eventbrite.

I was hoping to be able to get the URL from these programatically by doing something like this:

<?php
 $eventbrite_id = '707852093667';
 echo '<a href="https://eventbrite.co.uk/e/'. $eventbrite_id .'">More Info</a>'; 
?>

But it seems all Eventbrite page URLs take the form of https://eventbrite.co.uk/e/title-of-event-as-slug-707852093667

Of course, the event ID doesn't contain the info in this URL. I was hoping there would be an ID-only way to create a link. Do I need to set up an API call to get the permalink?


Solution

  • There is an ID-only way to create the link.

    If you use a URL in this format:

    https://eventbrite.co.uk/e/707852093667
    

    EventBrite's site will redirect you to the "full" URL in the format you mentioned in the question, i.e.

    https://eventbrite.co.uk/e/title-of-event-as-slug-707852093667
    

    So it doesn't matter which format you use, they both lead to the same place.