In the media Rest API, what is “missing_image_sizes”?

Basically, it corresponds to missing thumbnails or custom-sized images in your media library.

And it’s (by default) a private field in the REST API and the value is one or more image sizes as returned by wp_get_registered_image_subsizes().

And the function which is used with that field is wp_get_missing_image_subsizes() which returns:

(array) An array of the image sub-sizes that are currently defined but don’t exist for this image.

So for example, if you added a new image to your library and then — after the image’s thumbnail and other custom sizes are generated — you programmatically called add_image_size(), then you’d likely see the missing_image_sizes field containing the newly added image size when you request the image data through the REST API. E.g.

  • Request URL: (GET method)
    https://example.com/wp-json/wp/v2/media/123?context=edit&_wpnonce=<nonce>

  • Sample response for missing_image_sizes: "missing_image_sizes":["my_size"]