How WordPress handles code edition inside the Theme Editor ?
-
Hello,
For automation purposes, I’m parsing the code of theme files using the theme editor at
/wp-admin/theme-editor.php
I see that there are two interesting elements inside the HTML code of the theme editor with a theme file loaded.
The first being the textarea:
<textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4" style="display: none;">
The second is a mirror wrapper, as I understand, it is here to replicate the code of the textarea and put in form with colors, etc.
<div class="CodeMirror cm-s-default CodeMirror-wrap">
I’ve tried editing directly the code inside the textarea tag but after clicking save, it does say it is successfully updated, but after a refresh the old code is still there, the new code isn’t sent out inside the HTTP request (I checked it).
So I thought that, even though it is a pain, I might need to edit both the textarea and the mirror wrapper with the new code, but even then it’s not changing anything.
I feel like I’m missing something.
Does someone have an idea of how the theme editor is doing things on the backside exactly?
I was actually wondering if there were some sort of protection against unwanted modifications and that would be what is preventing me to do the changes directly into the HTML code.
Thanks a lot!
- The topic ‘How WordPress handles code edition inside the Theme Editor ?’ is closed to new replies.