$val ) { $absolute_path = str_replace( $base_url, $base_dir, $val['url'] ); if ( ! file_exists( $absolute_path ) ) { $val['url'] = str_replace( $find, $replace, $val['url'] ); $src[ $key ] = $val; } } } return $src; } function filter_wp_get_attachment_url( $url = '' ) { if ( is_admin() ) { return $url; } $wp_upload_dir = wp_upload_dir(); $base_dir = $wp_upload_dir['basedir']; $base_url = $wp_upload_dir['baseurl']; $find = get_site_url(); $replace = RH_USE_REMOTE_MEDIA_URL; $absolute_path = str_replace( $base_url, $base_dir, $url ); if ( ! file_exists( $absolute_path ) ) { $url = str_replace( $find, $replace, $url ); } return $url; }