What is “previews code”? Or do you mean “previous code”?
So, when editing a custom JS code, after clicking the “Update” button the changes are lost and the editor shows you the code before the changes?
If you inspect the website’s HTML on the frontend, is the JS code shown with or without the changes?
If you add a new custom JS code the changes are saved alright?
Do you have any caching plugins installed on the website?
-
This reply was modified 3 years ago by
SilkyPress.
Sorry for my bad english.
Yes, after clicking the “Update” button the changes are lost and the editor shows me the code that at some point was saved.
If I inspect the HTML in the Admin area (/wp-admin) the new changes are not showing.
If I add a new custome JS happend the same thing.
No I don’t have any caching plugin. But anyway I deactivated all my other plugins and try in a different browser and happened the same thing.
Does this happen every time you add/edit a custom code, or only for some custom codes?
Could you make me some screenshots of the “Edit JS code” page before the modifications, after modifications and after clicking the “Update” button? (Use the imgur.com site to upload the screenshots and link them here).
Yes this happens every time.
I uploaded the screen shots. Here is the link: https://imgur.com/a/G6uqnBD
In your second screenshot the editor’s line numbers are missing, as well as the syntax highlighting (the color for the ‘Testing’ string should be red). On my side it looks like this.
Would you try the following: open the “Add Custom JS” page and open the browser’s console (hit “Ctrl + Shift + I” and choose the “Console” tab) on that page. Then add “alert(‘Testing’);” as content in the code editor and see if there are any JS errors showing up in the browser’s console. Would you make me a screenshot of the page together with all the errors the browser’s console?
No, there is no console error.
Diana the problem was solved after moving one custom JS record to the trash. Aparently there was a conflict or something wierd with that entry. I don’t know if this can help but the JS insidet this one was:
jQuery(document).ready(function( $ ){
$('#wpcontent').html($('#wpbody').html().replace('Processed', 'Processed'));
});
I was trying to change the first parameter in replace() and it was when the problem begin.
Another thing that maybe can help is that I work with multiple tabs at the same time and I copy/paste a lot from one to another.
The editor is ignoring the code I paste and when I save the issue begins.
I’m a bit confused about the state of the issue. First you said that “the problem was solved …”, but then in the second message “the editor is ignoring … and the issue begins”. Did you find a solution or not? The aforementioned JS code snippet still doesn’t help me replicate your issue.