PHP code example of codelight-eu / wp-media-from-production

1. Go to this page and download the library: Download codelight-eu/wp-media-from-production library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codelight-eu / wp-media-from-production example snippets



define('WP_ENV', 'development');


define('MEDIA_PRODUCTION_REMOTE_URL', 'https://production-url.com');

// Optional, in case you're running Trellis or something that rewrites wp-content folder name
define('MEDIA_PRODUCTION_REMOTE_FOLDER', 'app');

// Optional, in case some of your images come from 3rd party domains, such as an image resizer
define('MEDIA_PRODUCTION_IGNORE_DOMAINS', [
    'resizer.com',
    'someotherdomain.com',
]);



add_filter('be_media_from_production_url', function() {
  return 'https://production-url.com';
});

add_filter('be_media_from_production_remote_content_dir', function() {
  return 'app';
});