Skip to content

Instantly share code, notes, and snippets.

@tott
Created November 8, 2013 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tott/7372827 to your computer and use it in GitHub Desktop.
Save tott/7372827 to your computer and use it in GitHub Desktop.
Make sure WordPress upload urls follow the same scheme as the main page.
add_filter( 'upload_dir', '_enforce_https_uploads' );
function _enforce_https_uploads( $upload_dir ) {
$upload_dir['url'] = preg_replace( '#^https?://#', '//', $upload_dir['url'] );
$upload_dir['baseurl'] = preg_replace( '#^https?://#', '//', $upload_dir['baseurl'] );
return $upload_dir;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment