Created
February 27, 2020 15:38
-
-
Save jesseeproductions/f6f11519d8d7db0496e4188ab21b16ff to your computer and use it in GitHub Desktop.
Modify the Event Permalink if there is a Website URL in The Events Calendar 5.0
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
/** | |
* Modify the Event Permalink if there is a Website URL in The Events Calendar 5.0 | |
* | |
* @param WP_Post $post Event Object | |
* | |
* @return WP_Post Event Object | |
*/ | |
function tribe_set_link_to_website_v2( $post ) { | |
$website_url = tribe_get_event_website_url( $post->ID ); | |
// Only swaps link if set | |
if ( ! empty( $website_url ) ) { | |
$post->permalink = $website_url; | |
} | |
return $post; | |
} | |
add_filter( 'tribe_get_event', 'tribe_set_link_to_website_v2', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment