How to Embed SoundCloud in your WordPress Posts by using oEmbed

One of our users asked us for an easy way to embed SoundCloud in their WordPress site. WordPress has this cool feature called oEmbed which supports auto-embedding as long as you post the URL in its own line. Currently the WordPress oEmbed library supports popular services like Youtube, Twitter, Vimeo, etc. However, SoundCloud is not supported by WordPress just yet. Well there is nothing to worry because WordPress makes it really easy to add oEmbed providers using wp_oembed_add_provider() function. In this article, we will show you how to add oEmbed support for SoundCloud in WordPress.

Update: You DO NOT have to use this tutorial anymore. WordPress 3.5+ has built-in oEmbed support for SoundCloud.

All you have to do is paste the following code in your theme’s functions.php file or in a site-specific plugin.

// Add SoundCloud oEmbed
function add_oembed_soundcloud(){
wp_oembed_add_provider( 'http://soundcloud.com/*', 'http://soundcloud.com/oembed' );
}
add_action('init','add_oembed_soundcloud');

That’s it. Simply paste your SoundCloud URL in a separate line and let the auto-embedding (oEmbed) magic do the rest.

There is a fairly popular plugin that you can use as well called SoundCloud is Gold which offers a lot of features. Alternatively because SoundCloud is officially supported by WordPress.com, there is a shortcode available for all WordPress.com users. So you can use the JetPack plugin for self-hosted WordPress and enable shortcode embeds option. Once you do that, you will be able to use the shortcode like this:

[soundcloud url=”http://api.soundcloud.com/tracks/207988″ iframe=”true” /]

Hopefully this will help anyone who is looking for a way to embed SoundCloud in WordPress.