I'm developing a child theme (mms-child) based on a simple parent (mms – also my dev). I am quite used to the usual way of defining custom image sizes within functions.php
as follows:
add_theme_support( 'post-thumbnails' );
add_image_size( 'Size name', 2000, 9999 );
I have removed all instances of this in the child theme's functions file, and checked to make sure there is nothing like this in the parent theme either. So – I am expecting nothing in my list of thumbnail sizes other than the standard WordPress defualts.
But the media area of the WordPress settings tells me this:
The sizes listed below are the crop and resize formats defined by mms-child
I have been though all files in both themes and can find nothing that would define these image sizes. I don't need them. How can I locate this instruction and remove it?
I'm developing a child theme (mms-child) based on a simple parent (mms – also my dev). I am quite used to the usual way of defining custom image sizes within functions.php
as follows:
add_theme_support( 'post-thumbnails' );
add_image_size( 'Size name', 2000, 9999 );
I have removed all instances of this in the child theme's functions file, and checked to make sure there is nothing like this in the parent theme either. So – I am expecting nothing in my list of thumbnail sizes other than the standard WordPress defualts.
But the media area of the WordPress settings tells me this:
The sizes listed below are the crop and resize formats defined by mms-child
I have been though all files in both themes and can find nothing that would define these image sizes. I don't need them. How can I locate this instruction and remove it?
Share Improve this question asked Jul 30, 2020 at 10:31 mtmmtm 538 bronze badges 1 |1 Answer
Reset to default 1These images sizes are defined by WordPress, and were added in WordPress 5.3. The comments in the source code describe them like this:
These sizes are meant to enhance the way WordPress displays images on the front-end on larger, high-density devices. They make it possible to generate more suitable
srcset
andsizes
attributes when the users upload large images.The sizes can be changed or removed by themes and plugins but that is not recommended. The size "names" reflect the image dimensions, so changing the sizes would be quite misleading.
The "Image sizes are defined by the current theme" screen from your screenshot is not part of WordPress. It must be from a plugin that you're using that is not aware of these new sizes and is incorrectly attributing them to your theme. You would need to ask its developer why.
You can stop them being generated by adding this line to a Must Use plugin:
remove_action( 'plugins_loaded', '_wp_add_additional_image_sizes', 0 );
But you really shouldn't, as they were added for a good reason.
functions.php
is just dumped in the root scope and not inside a function hooked toinit
or another action? – Tom J Nowell ♦ Commented Jul 30, 2020 at 10:53