• Resolved WPinThai

    (@wpinthai)


    I have 39 “active” snippets on my WordPress & WooCommerce website (all but one are PHP).
    BUT at some date recently they have all stopped working!

    I very recently updated the WPCode plugin to the latest version (along with various other plugins, including WooCommerce) but do not know if they were working just before that.

    • The snippets are still visible and enabled in the list in the WPCode plugin.
    • They do NOT have warning symbols next them
    • I have disabled all other plugins, and still the snippets did not work
    • I added a new snippet from the snippet library, made no changes & enabled it. It did not work (but again no visible error in the plugin list)
    • I disabled & re-enabled the WPCode plugin. It did not help.
    • I cannot find any table in my WordPress database with the text “snippets” in the name (but I could not find any such table in my website backups either)
      In all other respects, my website seems to be working normally

    Please can you tell me …

    • Where should the snippets be visible in my WordPress database so I can try to look for them?
    • Do you have any idea what the problem could be?
    • What do you recommend I do to try to get them working again?

    Thanks in advance

    Simon

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi Simon,

    Can you please check if any of your snippets have either a closing PHP tag or a comment tag that is not closed? Due to the way WPCode loads the snippets in order to identify errors this can prevent other snippets from being executed.

    Another option is that, depending on your server setup, a snippet may be causing a silent error and preventing others from being executed.

    Please reach out using the form at https://wpcode.com/contact if you want to share your snippets privately with us and we’ll help identify what is causing the issue.

    Thread Starter WPinThai

    (@wpinthai)

    Hi Mircea

    Thank you so much for your fast reply, especially on a Saturday!

    GREAT NEWS ! (& a question & suggestion)

    I put my active Snippets list in date order (latest at the top)

    I starting going down the list, looking at the code in each snippet for closing PHP tags …

    ?>

    … and closing PHP comment tags …

    // This is a single-line comment This is also a single-line comment

    /* This is a
    multi-line comment */

    In the first few tags (including a couple added straight from the Snippet library), I noticed they had an opening tag (<?php) at the top, greyed out (not editable) BUT no closing tag. I added the closing tag, saved the snippet.

    • ALL my snippets were still not working.
    • Strange thing was … when I looked again at the above snippets I had “changed”, the closing tag had disappeared (been removed)

    The next one in the list of snippets (a snippet I had pasted from the internet myeslf) already contained a closing tag. So (based on what I discovered above) I thought I would remove that closing tag

    • BINGO! GREAT NEWS ! ALL my snippets started working again!

    Does that sound like expected behaviour? Did I do the right thing?

    If yes, I would like to offer a couple of suggestions …

    • add info like the above to the FAQs & public documentation
    • ask the Dev team to consider adding a “closing tag not needed” type error notification to the otherwise excellent automatic error checking functionality within the plugin
    • add a comment to snippets in the library saying a closing tag does not need to be added (manually)

    Best Regards

    Simon

    Plugin Author Mircea Sandu

    (@gripgrip)

    Hi Simon,

    Thank you for the update and the suggestion. We’ll add that to our documentation.

    WPCode attempts to remove opening and closing PHP tags automatically but in some instances it may miss them.

    Thread Starter WPinThai

    (@wpinthai)

    Understood Mircea, and thanks again for your help and a great plugin

    Best Wishes

    Simon

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

The topic ‘All Code Snippets stopped working’ is closed to new replies.