Support » Plugin: iThemes Security (formerly Better WP Security) » Plugin breaks if jquery is deregistered

  • add_action('wp_enqueue_scripts', function () {

    breaks the plugin:

    Notice: Undefined index: jquery in better-wp-security/core/modules/wordpress-tweaks/class-itsec-wordpress-tweaks.php on line 349

    store_jquery_version() should check if $wp_scripts->registered[‘jquery’] is set before trying to use it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • I think this is related. The latest version of iThemes security forces a jQuery enqueue somehow. This breaks functionality with some other plugins. This is the extra jquery call I see when iThemes 6.2.1 is active.

    < script type=’text/javascript’ src=’http://&#8230;./wp-includes/js/jquery/jquery.js?ver=1.11.0′></script>

    This gets enqueued even though default WP jQuery is deregistered.


    Try and navigate to the WordPress Tweaks module, click on the Configure Settings button and then scroll down a fair bit till you see the “Replace jQuery With a Safe Version” setting.

    If this setting is enabled that’s what is enqueueing jQuery in the frontend.
    Oh and the version 1.11.0 is a bug. It should be 1.12.4 in the latest WordPress release (4.7.4) …

    I’m working on a theme locally and I have the same issue even if the setting mentionned by @pronl is unchecked.

    Thread Starter fiskhandlarn


    @mphilippe: do you have the same problem as me or @studiobovenkamer? because the answer by @pronl was for @studiobovenkamer’s issue.

    Anyhow, here is my temporary fix for the original problem until the plugin is fixed:

    if ( class_exists('ITSEC_WordPress_Tweaks') ) {
        add_action('init', function () {
            // better-wp-security tries to look for jquery in registered scripts
            // (which we've already removed in wp_enqueue_scripts),
            // disable that:
            remove_action( 'wp_print_scripts', array( ITSEC_WordPress_Tweaks::get_instance(), 'store_jquery_version' ) );
    • This reply was modified 4 years, 5 months ago by fiskhandlarn.


    Your issue is definately a bug but perhaps its worth mentioning the notice will only occur when accessing the frontend while logged in …

    If not logged in, the notice will not occur.

    In regards to the temporary fix, do note if you’re running PHP 5.2 or less then you can’t use anonymous functions…

    @fiskhandlarn, same as you, thanks for the fix, it worked. 🙂

    @pronl, thanks for the details.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Plugin breaks if jquery is deregistered’ is closed to new replies.