0

I have checked the code of the "Simple Image Sizes" plugin and found out how "they" read the available thumbnail/image sizes.

However when I use the get_intermediate_image_sizes() function in a plugin with an if( is_admin() ) clause surrounding it, it only returns the 3 standard WP sizes (thumbnail, medium, large).

I have 4 custom images sizes registered with add_image_size().

Any ideas?

  • Are all image sizes returned when you call get_intermediate_image_sizes in the frontend (without is_admin)? – engelen Jun 27 '14 at 19:09
  • Hi, no, that was exactly the case. I couldn't get it to work at all in the front end. Found out that I had to use a "later hook" because WP wasn't ready with reading the additional sizes yet. – Matthias Max Jun 27 '14 at 19:10
  • Ah, so you've solved it? In that case, please add an answer to your own question explaining your solution and accept it. That way, it can be useful to other people as well :-)! – engelen Jun 27 '14 at 19:11
0

The problem was that I read the image sizes inside the "init" hook at which point the additional sizes are not loaded yet by Wordpress. I used a "later" hook now and it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.