Skip to content

Instantly share code, notes, and snippets.

View jeff-kilbride's full-sized avatar

Jeff Kilbride jeff-kilbride

  • Los Angeles, CA
View GitHub Profile
@jeff-kilbride
jeff-kilbride / filter-wp-uploads.php
Created March 28, 2018 01:26 — forked from kopiro/filter-wp-uploads.php
Filter wordpress uploads
<?php
add_filter('wp_get_attachment_url', function($url) {
if (getenv('USE_S3_UPLOADS')) {
$url = 'https://' . getenv('AWS_S3_BUCKET') . '.s3.amazonaws.com' . str_replace(WP_CONTENT_URL, '', $url);
}
return $url;
});
add_filter('wp_calculate_image_srcset', function($sources) {