Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

When adding an image as a featured image to a post - if the image is an existing image in the Media Library, then the image is not added as a true attachment but as a thumbnail, shown like this in the JSON feed:

"attachments": [],
"comment_count": 1,
"comment_status": "open",
"thumbnail": "http://sitename.com/wp-content/uploads/image.png"

but if the image is not added from the Library, but uploaded then it is added as an attachment and a thumbnail - shown like this:

"attachments": [
                {
                    "id": 8,
                    "url": "http://sitename.com/wp-content/uploads/image.png",
                    "slug": "evac",
                    "title": "evac",
                    "description": "",
                    "caption": "",
                    "parent": 1,
                    "mime_type": "image/jpeg",
                    "images": {
                        "full": {
                            "url": "http://sitename.com/wp-content/uploads/image.png",
                            "width": 1280,
                            "height": 720
                        },
                        "thumbnail": {
                            "url": "http://sitename.com/wp-content/uploads/image-150x150.png",
                            "width": 150,
                            "height": 150
                        },
                        "medium": {
                            "url": "http://sitename.com/wp-content/uploads/image-300x168.png",
                            "width": 300,
                            "height": 168
                        },
                        "large": {
                            "url": "http://sitename.com/wp-content/uploads/image-1024x576.png",
                            "width": 625,
                            "height": 351
                        },
                        "post-thumbnail": {
                            "url": "http://sitename.com/wp-content/uploads/image-624x351.png",
                            "width": 624,
                            "height": 351
                        }
                    }
                }
            ],
"comment_count": 1,
"comment_status": "open",
"thumbnail": "http://sitename.com/wp-content/uploads/image-624x351.png"

Any suggestions why this would be and if there is a solution to have the feature image shown the same way in either circumstance?

This is a clean install, and the only plugin i am using is the JSON API plugin.

Edit: Also noticed that when selecting a post Featured image that is already loaded into the Media Library, that image show "Unattached" in the "Uploaded to" column in the Media Library - I think this is where the discrepancy starts. Whereas when uploading it, it shows it being attached to that specific post.

share|improve this question
    
That's the output from the plugin, right? You'd have to inspect its code to see how it deals with this. At a first look, maybe you'll have to use the constant JSON_API_DIR and customize your output (if we're talking about the same plugin). –  brasofilo May 14 '13 at 16:56
    
Yeah, that's the output from the plugin, I guess the plugin is what is building the JSON - will try to check out the JSON_API_DIR and see if that helps. –  whodeee May 14 '13 at 17:23
    
looks as if it is a WP bug - submitted a bug report –  whodeee May 16 '13 at 18:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.