• Resolved Tij

    (@tijhaart)


    I want to deregister a script on certain pages, but I get php notices when I call wp_deregister_script during the “wp_print_scripts” action.

    The notices occur in “wp-includes/class.wp-scripts.php on line 158”. The first: “Undefined index: <scriptname>” and second: “Trying to get property of non-object”.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try it with the wp_enqueue_scripts action hook.

    Thread Starter Tij

    (@tijhaart)

    I will give it a try. Thanks.

    Some result… I already tried for you ??

    Ah… sorry, it depends on the fact that somewhere the script is enqueued, so you must use wp_dequeue_script.

    Thread Starter Tij

    (@tijhaart)

    wp_dequeue_script was actually the problem, because when I hooked into this action, the script didn’t get removed. With wp_print_scripts it did got removed but would result in the above notice.

    In the end is doesn’t matter, because the script I wanted to remove was enabled by a plugin and I’m not going to use the plugin anymore.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘deregister script "Trying to get property of non-object in…" notice’ is closed to new replies.