• Resolved nyamsprod

    (@nyamsprod)


    I had to hack the code because the function could not populate the thumbnail post property if the image was present in my media files BUT was not attached to the current post

    if (function_exists('get_post_thumbnail_id')) {
            $img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail');
            $this->thumbnail = $img[0];
        } else {
            $attachments = $json_api->introspector->get_attachments($this->id);
            foreach ($attachments as $attachment) {
                if ($attachment->id == $values[0]) {
                    $image = $attachment->images['thumbnail'];
                    $this->thumbnail = $image->url;
                    break;
                }
            }
        }

    Hope it may help other people

    https://www.ads-software.com/extend/plugins/json-api/

Viewing 1 replies (of 1 total)
  • Thanks for the bug report. I included a modified version of this in the 1.0 release. Let me know if that fixes it for you.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: JSON API] set_thumbnail_value bug and fixed’ is closed to new replies.