Replies: 0
Here’s what I’ve done:
Created the Testimonials Pod:
- – I created a Testimonials pod and enabled REST API and checked read-only.
- – I enabled Featured Image from the Advanced settings panel
- – I saved the pod and double-checked these options were saved
Created the Testimonials
- – I made 3 testimonials, each with a Featured Image.
- – I access the testimonials via /wp-json/wp/v2/testimonials
- While this shows a nice JSON view of my Testimonials, only the very last post in the testimonials has a Featured Image href that actually works and that looks like this: “wp:attachment”: [{href: http://localhost:888/wp-json/wp/v2/media?parent=63}] .
- The rest return empty arrays instead of a Featured Image URI.
- When I view the one href that works, it has ALL the Featured Images for all three testimonials. I have no idea why that would be. Here is what that looks like: https://pastebin.com/Qtjqgsi3
- This isn’t a template issue because I am just in JSON at this point. I do have Featured Images enabled in my functions.php file and they do show up when I view the pages through the browser.
Here is how Featured Images are enabled in functions.php:
function mytheme_post_thumbnails() {
add_theme_support( 'post-thumbnails' );
add_post_type_support( 'page', 'excerpt' );
}
add_action( 'after_setup_theme' , 'mytheme_post_thumbnails' );