How to display image sizes in API embedded?

Question

I have just used regenerate images tool to regenerate image sizes and it was successful though I need those image sizes to show up in wp rest api when calling post in _embedded field. As you can see it’s an empty object.

enter image description here

What should I do to enable image sizes there? Do I need to insert some code in functions.php file or somewhere else?

This is what is written in functions.php for now:

add_image_size( 'medium', '150', '150', false );
add_image_size( 'thumbnail', '414', '414', false );
add_image_size( 'medium_large', '768', '0', false );
the_post_thumbnail(); // Without parameter ->; Thumbnail
the_post_thumbnail( 'thumbnail' ); // Thumbnail (default 150px x 150px max)
the_post_thumbnail( 'medium' ); // Medium resolution (default 300px x 300px max)
the_post_thumbnail( 'medium_large' ); // Medium-large resolution (default 768px x no height limit max)
the_post_thumbnail( 'large' ); // Large resolution (default 1024px x 1024px max)
the_post_thumbnail( 'full' ); // Original image resolution (unmodified)
the_post_thumbnail( array( 100, 100 ) ); // Other resolutions (height, width)
0
, , , , Egle Ged 3 months 0 Answers 37 views 0

Leave an answer