I’ve tried to solve my problem all day now and hopefully someone can help me here.

This is my goal: Beeing able to edit and save files located in the uploads directory (for example wp-content/uploads/myplugin/style.css).

I already managed to create a site with a textarea that contains the code from the style.css. I did it this way:

<textarea><?php include([dynamic_path_to_file]) ?></textarea>

This is working fine. I also managed to integrate the codemirror-editor which is looking and working really nice.

Now I want to save the file after editing its content.

How can I do that?

I already tried some AJAX-Functions, for example as it is explained here: https://stackoverflow.com/questions/9543224/how-to-sending-php-code-from-codemirror-editor-via-jquery-ajaxpost-and-using-p

I was also thinking of something like putting it in a form and send it somewhere on submit but I did not manage to get any good result.

If you can help me with my problem you’d really make my day.

Thank you in advance, Oliver!


I got answer to that question in the wordpress-support-forum: https://wordpress.org/support/topic/overwrite-a-file-with-the-context-of-a-textarea/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.