mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-02 12:02:25 +08:00
16 lines
502 B
Text
16 lines
502 B
Text
function jetpackblog_external( $skip, $image_url, $args, $scheme ) {
|
|
// Get your site URL, without the protocol
|
|
$site_url = preg_replace( '~^(?:f|ht)tps?://~i', '', get_site_url() );
|
|
|
|
/**
|
|
* If the image URL is from your site,
|
|
* return default value (false, unless another function overwrites).
|
|
* Otherwise, do not use the CDN
|
|
*/
|
|
if ( strpos( $image_url, $site_url ) ) {
|
|
return $skip;
|
|
} else {
|
|
return true;
|
|
}
|
|
}
|
|
add_filter( 'jetpack_photon_skip_for_url', 'jetpackblog_external', 9, 4 );
|