Search code examples
jsonangularjswordpresswp-api

New thumbnail size url in WP returning "0" with Angular and WP-API


I'm working on a project using WP-API and Angular.

I just added a new custom image size to the functions.php

My /wp-json/posts (the JSON output) shows the url for the new image size and using the url works.

http://localhost/mysite/wp-content/uploads/2015/07/6823214-large-600x300.jpg

But outputting the URL with Angular doesn't work (returns "0")

{{house.featured_image.attachment_meta.sizes.blog-thumb.url}}

However this still works fine (the original sizes):

{{house.featured_image.attachment_meta.sizes.medium.url}}
{{house.featured_image.attachment_meta.sizes.thumbnail.url}}

Solution

  • This might have something to do with the "-" in the name (blog-thumb). I tried doing everything the same again using a new name (blogthumb) and everything worked fine!

    Then just to make sure I added a new image size called "test-er" and had the same issues as the first time around.