Skip to content

Instantly share code, notes, and snippets.

@s9011514
Last active December 15, 2015 09:06
Show Gist options
  • Save s9011514/a9c2adf673124e84cd23 to your computer and use it in GitHub Desktop.
Save s9011514/a9c2adf673124e84cd23 to your computer and use it in GitHub Desktop.
解決WordPress 4.4 媒體庫破圖(srcset)設定問題 https://sofree.cc/wp-srcset-media-image-broken/
<?php
add_filter('wp_get_attachment_image_attributes', function($attr) {
if (isset($attr['sizes'])) unset($attr['sizes']);
if (isset($attr['srcset'])) unset($attr['srcset']);
return $attr;
}, PHP_INT_MAX);
add_filter('wp_calculate_image_sizes', '__return_false', PHP_INT_MAX);
add_filter('wp_calculate_image_srcset', '__return_false', PHP_INT_MAX);
remove_filter('the_content', 'wp_make_content_images_responsive');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment