• Resolved Oscar Otero

    (@oscarotero)


    Every time I save my changes the page refreshes and shows the previews code, making me loose all my work.

    *WordPress Version: 6.2, Code Type: Javascript, Linking Type: Internal, Where on page: head, Where in site: In Admin

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Diana Burduja

    (@diana_burduja)

    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?

    Thread Starter Oscar Otero

    (@oscarotero)

    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.

    Plugin Author Diana Burduja

    (@diana_burduja)

    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).

    Thread Starter Oscar Otero

    (@oscarotero)

    Yes this happens every time.

    I uploaded the screen shots. Here is the link: https://imgur.com/a/G6uqnBD

    Plugin Author Diana Burduja

    (@diana_burduja)

    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?

    Thread Starter Oscar Otero

    (@oscarotero)

    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.

    Thread Starter Oscar Otero

    (@oscarotero)

    The editor is ignoring the code I paste and when I save the issue begins.

    Plugin Author Diana Burduja

    (@diana_burduja)

    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.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Loosing changes after saving edit’ is closed to new replies.