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:
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’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/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!
Share Improve this question asked Oct 18, 2018 at 15:00 OliverOliver 11 bronze badge1 Answer
Reset to default 0I got answer to that question in the wordpress-support-forum: https://wordpress/support/topic/overwrite-a-file-with-the-context-of-a-textarea/