• Resolved JapeNZ

    (@japenz)


    Hi there,

    I have a four snippets that are being automatically deactivated, but I can’t work out why.

    I’m seeing a lot of these in my error log:

    Attempt to read property “post_type” on null

    And I’m wondering if that might be the issue?

    One of the snippets is the disable automatic updates, I have no idea why that would be automatically deactivated:

    // Disable core auto-updates
    add_filter( 'auto_update_core', '__return_false' );
    // Disable auto-updates for plugins.
    add_filter( 'auto_update_plugin', '__return_false' );
    // Disable auto-updates for themes.
    add_filter( 'auto_update_theme', '__return_false' );

    Any suggestions would be very much appreciated!

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

    (@gripgrip)

    Hi @japenz,

    The snippets are getting deactivated as they are generating an error or notice you can read more about how that system works in this article.

    Due to the way the code is dynamically executed in PHP snippets in WPCode multiple snippets may get deactivated but the one that is causing the issue in your case is the one trying to use “post_type” on a null value.

    To quickly identify the snippet causing the original issue you can use the search in the list of WPCode code snippets to search for “post_type” and that should help you narrow it down at least and then you can add checks in place to avoid the error. More info on how to identify errors and attempt to fix them can be found here: https://wpcode.com/docs/how-to-debug-php-errors-in-wpcode/

    If you need help debugging this further please reach out using the form at https://wpcode.com/contact

    Thread Starter JapeNZ

    (@japenz)

    Hi @gripgrip,

    Thank you for getting back to me!

    I was able to find the snippet that was causing the error by searching for “post_type”, then deactivating and reactivating them until the culprit was discovered!

    Awesome support, very much appreciated 🙂

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

The topic ‘“automatically deactivated”’ is closed to new replies.