Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Featured Images not showing up in JSON of pod

$
0
0

Replies: 0

Here’s what I’ve done:

Created the Testimonials Pod:

  1. – I created a Testimonials pod and enabled REST API and checked read-only.
  2. – I enabled Featured Image from the Advanced settings panel
  3. – I saved the pod and double-checked these options were saved

Created the Testimonials

  1. – I made 3 testimonials, each with a Featured Image.
  2. – 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.
  3. 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
  4. 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' );
  • This topic was modified 5 minutes ago by nate22.
  • This topic was modified 2 minutes ago by nate22.
  • This topic was modified 2 seconds ago by nate22.

Viewing all articles
Browse latest Browse all 59525

Trending Articles