Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaModal callback sometimes returns an array #82

Open
gilbarbara opened this issue Feb 18, 2016 · 0 comments
Open

MediaModal callback sometimes returns an array #82

gilbarbara opened this issue Feb 18, 2016 · 0 comments

Comments

@gilbarbara
Copy link

Hello,

Thanks for this repo, it's a life saver!
I'm having some errors in this new site that I'm working. If I remove the selected image and try to add it again I'm getting a WordPress alert with "Could not set that as the thumbnail image.."

I was trying to see what was going on and the MediaModal callback attachment parameter is an array instead of an object for the subsequent calls.

cb : function(attachment){
    MultiPostThumbnails.setAsThumbnail(attachment.id, "%2$s", "%1$s", "%4$s");
}

I was able to fix with attachment.id || attachment[0].id for setAsThumbnail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant