• Resolved dlsn

    (@dlsn)


    Hello there,

    I’m just programming my own plugin and I want it to offer the possibility to edit a specific file in the backend which stores for example custom css-code.

    I used the method file_put_contents() but nothing happend, no file was stored (and the directory was correct!). So I tried it with error reporting but no error was shown. As I thought that the reason could be the directory permissions I look at the permissions of the directory of the file and of the file itself. I changed the permissions for a short time so that every permission is given for everyone (rwx-rwx-rwx) – but it still didn’t work.

    Then I tried to edit the same file by using the WordPress plugin editor – and – it worked (no matter that the permission was ‘rwx-r—r–‘. But this way doesn’t fit for me cause I need a way to let my website editors only writing one but not all files of my plugin.

    So now my question: How is it possible to programm a text-file-editor similar to the wordpress plugin editor but only for one specific file?

    Or more general: How can I programm a text field for the backend from which the inserted text is stored in a file of the plugin directory?

    Thank you
    Daniel

    • This topic was modified 2 years, 3 months ago by Jan Dembowski.
Viewing 2 replies - 1 through 2 (of 2 total)
  • While this doesn’t answer your exact question, hopefully you’ll find this advice helpful:

    1) People can already add custom CSS via the customizer, or a multitude of other ways. It seems really not worth your time to develop yet-another css file editor

    2) If you really want to go this route, instead of editing an actual file, why not just store the CSS in the database?

    Thread Starter dlsn

    (@dlsn)

    Ok, thanks then I try it via the database

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin – Edit file in the backend through’ is closed to new replies.