Skip to content

Instantly share code, notes, and snippets.

@eteubert
Created April 10, 2020 08:52
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 eteubert/d3faac8c90661b357c88d67e8e7a8208 to your computer and use it in GitHub Desktop.
Save eteubert/d3faac8c90661b357c88d67e8e7a8208 to your computer and use it in GitHub Desktop.
Podlove Publisher: Enable Podtrac Support
<?php
// see https: //analytics.podtrac.com/how-to-measure/
add_filter('podlove_enclosure_url', function ($original_url) {
$ext = pathinfo($original_url, PATHINFO_EXTENSION);
$schemeless_url = preg_replace('/^https?:\/\//', '', $original_url);
$podtrac_prefix = "https://dts.podtrac.com/redirect.$ext/";
return $podtrac_prefix . $schemeless_url;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment