Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter richardstam

    (@richardstam)

    Addition: instead of waiting for an autosave, you could also press preview (then the page is also autosaved) and refresh the tab in which you are editing the page. This will also cause the script to fail with a “redefine”-error

    Thread Starter richardstam

    (@richardstam)

    Thanks for your reply.
    I’m sure the function is not defined twice in my code.
    The issue is: I get the error only when the snippet is called from a page that has been saved by autosave. So when no autosave exists, then the error does not occur.

    My assumption is that the code is run from both the autosaved and the normal page.

    How to reproduce:
    – create a snippet containing a function
    – add the shortcode for the snippet to a page (in the gutenberg editor).
    – go to the page and see that all is fine.
    – wait until the page is autosaved (normally after 1 minute)
    – open the page in the gutenberg editor
    result: The editor does not open, but you will get an error stating the redefinition of the function.

    Thanks for your help!

    • This reply was modified 4 years, 1 month ago by richardstam.
Viewing 2 replies - 1 through 2 (of 2 total)