• Resolved Dandydahlia

    (@dandydahlia)


    Hi,

    Awesome plugin thank you! Hoping for some help please – I made a PHP snippet … which crashed my site.

    I’ve googled high and low so did the following:
    – I went via FTP and renamed the plugin to old-insert-headers-and-footers
    – I found the snippet stored in my database under _posts – I searched by most recent then just deleted it
    … and hooray my site came back.. BUT I can’t get the plugin back on the site with my old working snippets, without crashing the site:

    To get the plugin back I tried these things:

    • I renamed my plugin back to insert-headers-and-footers but the site still crashed so..
    • I left it as old-insert-headers-and-footers and went into my Plugins > Activate it again, and again it crashed and I worked out I had to rename the plugin again to have a live site
    • I checked my error log which said: [29-Dec-2022 00:40:22 UTC] PHP Fatal error: Uncaught Error: Call to a member function get_queried_object() on null in /home/hosting/mysite.com/wp-includes/query.php:44 (more info below)

    Do you have any advice please on how I get the plugin back?

    Thanks in advance!

    [29-Dec-2022 00:40:22 UTC] PHP Fatal error:  Uncaught Error: Call to a member function get_queried_object() on null in /home/hosting/mysite.com/wp-includes/query.php:44
    Stack trace:
    #0 /home/hosting/mysite.com/wp-content/plugins/old-insert-headers-and-footers/includes/conditional-logic/class-wpcode-conditional-page.php(206): get_queried_object()
    #1 /home/hosting/mysite.com/wp-content/plugins/old-insert-headers-and-footers/includes/conditional-logic/class-wpcode-conditional-type.php(137): WPCode_Conditional_Page->get_taxonomy()
    #2 /home/hosting/mysite.com/wp-content/plugins/old-insert-headers-and-footers/includes/conditional-logic/class-wpcode-conditional-type.php(107): WPCode_Conditional_Type->evaluate_rule('taxonomy_page', '=', 'plan')
    #3 /home/hosting/mysite.com/wp-content/plugins/old-insert-headers-and-footers/includes/class-wpcode-conditional-logic.php(151): WPCode_Conditional_Type->evaluate_rule_row(Array)
    #4 /home/hosting/mysite.com/wp-content/plugins/o in /home/hosting/mysite.com/wp-includes/query.php on line 44
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Dandydahlia

    (@dandydahlia)

    I also tried to completely delete the plugin (via FTP) then reloaded the plugin from wordpress, but when I activated it, it caused a white screen too.

    Is there somewhere else that faulty snippet might have saved? somewhere else i need to delete? (I have optimised and repaired my database tables)

    Thread Starter Dandydahlia

    (@dandydahlia)

    So.. me again – in case it helps anyone, I went back into my site a few minutes later and activated the plugin, again it went to a critical error.. BUT I visited https://mysite.com/wp-admin/?wpcode-safe-mode=1 and it seemed ok. I also remade the same PHP (codeless) with the same name and saved it – wish I hadn’t deleted the line from my _posts table! As it could have just deactivated it.

    Not sure if that’s right. But at least my white screen / critical error is gone thank goodness

    Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @dandydahlia,

    Thank you for reporting this.

    Yes, the best way to get unstuck in these situations is to use the safe mode as described in this article.

    I would advise against deleting database rows directly as that can have side-effects and simply using the safe mode to disable the snippet will make it work.

    We are going to improve the way we handle those rules to prevent the error in the next release.

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

The topic ‘Critical Error – deleted code in PHP but can’t reload plugin’ is closed to new replies.