private static function is_internal_content($url) { // using content_url() instead of site_url or home_url is IMPORTANT // otherwise you run into errors with sites that: // 1. use WPML plugin // 2. or redefine content directory $is_content_url = strstr($url, content_url()); // this case covers when the upload directory has been redefined $upload_dir = wp_upload_dir(); $is_upload_url = strstr($url, $upload_dir['baseurl']); return $is_content_url || $is_upload_url; }