Skip to content

Instantly share code, notes, and snippets.

@cliffordp

cliffordp/functions.php

Last active Aug 29, 2015
Embed
What would you like to do?
Adding custom SmugMug domain to oEmbed whitelist in WordPress (full regex version)
<?php
// From http://tourkick.com/2014/smugmug-custom-domain-oembed-wordpress/
// This version is based on the SmugMug code from wp-includes/class-oembed.php
// Even if you set both WWW and non-WWW versions as CNAMEs in your DNS settings, an oEmbed attempt to the wrong custom SmugMug domain (e.g. WWW if the custom domain in your SmugMug settings is non-WWW) will not work, which is why (www\.)? is not in the regex
// for a custom SmugMug subdomain like http://media.mydomain.com (notice the "backslash-dot" after the subdomain)
wp_oembed_add_provider( '#https?://?media\.mydomain\.com/.*#i', 'http://api.smugmug.com/services/oembed/', true );
// for a custom SmugMug domain like http://mydomain.com:
//wp_oembed_add_provider( '#https?://?mydomain\.com/.*#i', 'http://api.smugmug.com/services/oembed/', true );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.