Get Transistor.fm oEmbed HTML programatically in WordPress
dev wordpressI recently had a request to programatically embed Transistor.fm podcast links in a WordPress template. The block editor seems to handle these links just fine. However, this wasn't going to be embedded in the content area but generated dynamically based on a third party API response.
WordPress has a built in set of oEmbed providers - for one of those, you can can get the HTML with wp_oembed_get
$html = wp_oembed_get($link);
Transistor wasn't one of them so that was returning false, but there's a function for that-
//add transistor as an oEmbed provider
wp_oembed_add_provider('https://share.transistor.fm/*', 'https://share.transistor.fm/oembed');
Transistor's docs didn't seem to have any oembed provider info but an endpoint exists!