Skip to content

Instantly share code, notes, and snippets.

@JustinSainton
Created August 8, 2018 20:53
Show Gist options
  • Save JustinSainton/705b8b772010999d7d659915439cc985 to your computer and use it in GitHub Desktop.
Save JustinSainton/705b8b772010999d7d659915439cc985 to your computer and use it in GitHub Desktop.
Import blocked attachments
<?php
add_filter( 'http_request_args', function( $args ) {
if ( ! defined( 'WP_IMPORTING' ) || ( defined( 'WP_IMPORTING' ) && ! WP_IMPORTING ) ) {
return $args;
}
if ( ! isset( $args['headers']['Authorization'] ) ) {
$args['headers']['Authorization'] = 'Basic ' . base64_encode( 'user:pass' );
}
return $args;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment