php - Wordpress returning wrong image size after changing

I am fetching the featured image of a post by the function
the_post_thumbnail('medium');
It was fetching the correct image before but I had changed the size of medium from 300 to 400 in wordpress media settings and regenerated all the images. The image with size 400 is present and got generated. But now it continues to fetch the 300 resolution image instead of 400.
How can I fix this and make it fetch the 400 size image?
Answer
Solution:
use this line of code add function.php
add_image_size( 'homeFeatured',300, 300, array('center','center') );
using this get the file in a specific size of the file.
<?php the_post_thumbnail('homeFeatured') ?>
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: using $this when not in object context
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.