• Resolved csdsubscriber

    (@csdsubscriber)


    It looks like about a year ago people were reporting similar issues. I have a code snippet for a shortcode that doesn’t seem to be updating to the latest saved version consistently. The other night it got so bad I had to roll back my website a couple days to get rid of it. I was getting a fatal error for the entire public site. It seemed to be because it believed I had loaded another snippet with the same procedure name, even though it was just a resave of the same snippet.

    My restored backup got me back on track with my older production version working. But now this morning I’ve saved a revised version I tested as working, but it once again seems to be using the older version. I use Siteground’s Speed Optimzer plug for caching. I had the CDN turned on during the major critical error period but I’ve since disabled that just in case it was the culprit. Of course I also did a lot of Speed Optimzer and browser cache purging. Eventually I moved to using an Incognito window to test the page where the old code seems to be persisting.

    I love this plugin. It makes deploying code (which I’m new at with PHP) very simple. Any suggestions how to sleuth this old version persistence?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Carolina

    (@carolinaop)

    Hi @csdsubscriber,
    Thanks for the detailed feedback and for your kind words about Code Snippets!

    From what you’ve described, it sounds like the issue may involve cached versions of your snippets being served, rather than the latest saved copy. The fatal error you encountered (with duplicate function or procedure names) often happens when an older version of the code is still loaded alongside the newer one.

    Since you’re using SiteGround shared hosting, there are a few additional caching behaviors to be aware of that may explain why older snippet versions sometimes persist.

    Here’s what we recommend:

    1. Fully Clear All SiteGround Caches
    • In your WordPress dashboard, open Speed Optimizer → Caching → Dynamic Cache and click Flush Cache.
    • Then go to File-Based Cache and click Flush Cache again.
    • If Memcached is enabled (via Site Tools → Speed → Caching → Memcached), click Flush Cache there as well to clear the object cache

    2. Temporarily Disable Dynamic Cache
    • In Speed Optimizer → Caching, turn off Dynamic Cache entirely for testing.
    • SiteGround’s Dynamic Cache sometimes retains compiled PHP output even after changes, so this step helps confirm if the cache is masking a snippet update

    3. Confirm Code Snippets Regeneration
    • Open your snippet, make a simple edit (like adding a comment), save, then deactivate → reactivate it.
    • This forces Code Snippets to recompile and reload your snippet

    4. Exclude Critical Pages from Caching
    • If your shortcode displays dynamic output, consider excluding its page from Speed Optimizer caching.
    • Then, purge the cache once from Site Tools → Speed → Caching → Dynamic Cache → Flush Cache .

    Test in an incognito/private browser, with your CDN disabled, to ensure you’re seeing a fresh request.

    If you’ve gone through these steps and the issue persists, it may help to reach out directly to SiteGround’s Support Team. They can perform a server-level cache purge for Dynamic Cache, Memcached, and PHP OPcache to completely clear out stale data.

    Thanks again for using Code Snippets 🙂

    Best regards,
    Carolina

    Plugin Contributor Carolina

    (@carolinaop)

    Hello,

    As we haven’t heard back, I’ll proceed with closing this ticket for now. If you need any further assistance, please feel free to reopen it at any time—we’ll be glad to help ☺️

    Thread Starter csdsubscriber

    (@csdsubscriber)

    Hi Caronina,

    Sorry for dropping off the map on this one. I did solve the problem so I’ll share what that entailed.

    Turns out we had a couple functions in that snippet that we being called very early on and the block was to protect them. What we ended up doing is recreating them in a snippet (without saving) then deactivating the original snippet again resulting of course in our site crashing once more.

    Then we found the original snippet in the database and deleted those functions from it. Then marked the new snippet and the original snippet “activated” again in their respetive database records and saved. Thing worked after that, including being able to save/activate/deactivate the original snippet.

    That was quite a ride lol!

    So yes, with that please feel free to close this one off now. Hopefully that stays as a helpful piece of info if anyone else ever ends up in this kind of jam.

    Plugin Contributor Carolina

    (@carolinaop)

    Hi @csdsubscriber!

    Thank you for your follow up!

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.