This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| define( 'STAGING_URL', 'https://staging.mysiteurl.com'); | |
| define( 'PRODUCTION_URL', 'https://www.mysiteurl.com'); | |
| add_filter( 'wp_get_attachment_url', 'yanco_staging_wp_get_attachment_url', 1000000, 2 ); | |
| function yanco_staging_wp_get_attachment_url( $url, $attachment ) | |
| { | |
| if( strpos( $url, STAGING_URL ) !== false ) { | |
| $url = str_replace( STAGING_URL, PRODUCTION_URL, $url ); |