Frontend wp_editor for WordPress works for Media files upload when having a user role of admin. The issue starts when a user tries to use the frontend form wp_editor in uploading files using the Media buttons and all we get is an error notification saying “You don’t have permission to attach files to this post.”

Oh well, great, spent hours trying to fix the issue but still no luck. Found a solution that may fix my problem but it’s not a good hack, trying to update the WordPress core.. tsktsk

Surprisingly, the solution is just to give the user role the capabilities for pages, edit and publish.

Anyway here’s the link :¬†https://wordpress.org/support/topic/solving-wp-media-upload-in-the-frontend-and-tml?replies=4#post-4851176