benhuson / Taxonomy-Images

Enables WordPress users to easily associate images from the media library to categories, tags and custom taxonomies.
https://wordpress.org/plugins/taxonomy-images/
21 stars 5 forks source link

Uploading image to custom taxonomy gives error: 'You don't have permission to attach files to this post' #28

Closed jtyarks closed 8 years ago

jtyarks commented 8 years ago

When trying to upload to an image directly to a custom taxonomy term through the media modal, an error appears. ("You don't have permission to attach files to this post")

Notes: • Does not happen with core taxonomies • Happens regardless of user role • Reproducible on WordPress 4.3 and 4.4 • Happens regardless of theme/plugins activated • Happens regardless of post type said custom taxonomy is attached to (i.e. core or custom) • Images already uploaded to media library can be added

I've created a vanilla install of WP with a Twenty Sixteen child theme—only customization being the custom taxonomies—and created a video to highlight the issue: http://www.pelagic-id.com/bugs/taxonomy-images-upload-error.mov

The custom taxonomy code is copied directly from register_taxonomy Codex page.

I'm attaching the functions.php file in case that brings any issues to light. functions.txt

benhuson commented 8 years ago

I've not been able to recreate this issue even though it is clearly demonstrated in your video.

Can you try one thing for me...

If you create a new custom term, then refresh the page before trying to upload an image, does that work?

Thanks

jtyarks commented 8 years ago

Many thanks for looking into it. I'm afraid creating a new term, refreshing the page, and then uploading image has the same results.

Would you like access to this environment? It's not being used for anything other than tests.

benhuson commented 8 years ago

That would be really useful thanks. You can email me at ben@thewhiteroom.net

jtyarks commented 8 years ago

@benhuson Credentials have been sent over.

benhuson commented 8 years ago

Thanks, I'll try to find time to test

clarkewd commented 8 years ago

This issue is also happening for me with a custom post type. I would love to fix this the right way. I am currently working around by commenting out the ajax security functions in wp-admin/includes/ajax-actions.php - not ideal but it works for the moment. screen region 2016-01-14 at 14 42 35

jamirmachado commented 8 years ago

Same issue here.

Error occurs when "editor" user role try to upload image. Admin user is fine.

clarkewd commented 8 years ago

doesn't work for me even with the admin user - hope we can get a fix soon

benhuson commented 8 years ago

Hi all.

Please could you try this version of the plugin with a patch that may fix the post permission issues. https://github.com/benhuson/Taxonomy-Images/tree/js-post-error

Please clear your browser cache after installing the plugin and let me know if this helps.

Many thanks

Ben

jtyarks commented 8 years ago

@benhuson — That fixed the issue I was experiencing, thanks!

benhuson commented 8 years ago

Thanks @jtyarks I'll try to get that fix released as soon as I am able.

benhuson commented 8 years ago

Merged in https://github.com/benhuson/Taxonomy-Images/commit/bad8860600f76767b08546f6631a354e0fca63f4