/**
* Get attachment image attributes.
*
* @param array $attr Image attributes.
* @return array
*/
function wc_get_attachment_image_attributes( $attr ) {
if ( isset( $attr['src'] ) && strstr( $attr['src'], 'woocommerce_uploads/' ) ) {
$attr['src'] = wc_placeholder_img_src();
if ( isset( $attr['srcset'] ) ) {
$attr['srcset'] = '';
}
}
return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'wc_get_attachment_image_attributes' );
Сегодня WP начал подгружать
header( "Content-Disposition: inline" );
$content_disposition = isset($_GET['content_disposition']) ? $_GET['content_disposition'] : 'attachment';
// Проверка наличия файла.
if ( ! file_exists( $'xml_filename' ) ) {
exit( 0 );
}
// Время создания файла
$file_time = filemtime( $opt['xml_filename' );
if ('inline' === $content_disposition) {
header( "Content-Disposition: inline" );
header( "Content-type: text/xml; charset=utf-8", true, 200 );
} else {
header( "Content-type: application/xml", true, 200 );
header( "Content-Disposition: attachment; filename=myxml" . date( "_d-m-Y_H:i:s", $file_time ) . ".xml" );
}
header( "Pragma: no-cache" );
header( "Expires: 0" );
readfile( $xml_filename );
exit( 0 );