[Support request] Plugins missing jQuery

Home Forums Support [Support request] Plugins missing jQuery

Home Forums Support Plugins missing jQuery

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #631421


    I have a couple of plugins that need jQuery to work in the backend. E.g. https://wordpress.org/plugins/smart-manager-for-wp-e-commerce/ and http://www.wpallimport.com/

    How do I enable it?

    I tried to enqueue it, with no luck. Still getting “Uncaught ReferenceError: jQuery is not defined”.

    add_action("admin_enqueue_scripts", "my_jquery_enqueue", 1);
    function my_jquery_enqueue()
       wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);

    Best regards

    GeneratePress 2.1.3
    Customer Support

    Hi there,

    this should do that:

    add_action( 'wp_enqueue_scripts', 'tu_load_jquery' );
    function tu_load_jquery() {
        wp_enqueue_script( 'jquery' );

    I’m still getting errors doing this. It’s missing jQuery’s live function. It was depricated quite a while back, but seems to be used in a few plugins, so maybe it’s adding the wrong version of jQuery back when just doing the wp_enqueue_script( 'jquery' );?

    That why I tried adding wp_register_script in my version.

    Both plugins have the same error Uncaught TypeError: $(...).find(...).live is not a function

    Note that I only get this when generatePress is active, and not when using any other theme, so something isn’t added back correctly.

    Lead Developer
    Lead Developer

    Can you link me to your site?

    Plugins that are coded properly will add jQuery as a dependency for their scripts in order to avoid issues like this.


    I did some more digging after your messages, and it turns out it wasn’t at all what I thought.

    I added an action which silenced the “JQMIGRATE: Migrate is installed, version 1.4.1” spam.

    add_action( 'wp_default_scripts', function( $scripts ) {
        if ( ! empty( $scripts->registered['jquery'] ) ) {
            $scripts->registered['jquery']->deps = array_diff( $scripts->registered['jquery']->deps, array( 'jquery-migrate' ) );
    } );

    Do you have a good solution to remove the spam and still get compatibility with GeneratePress?

    Lead Developer
    Lead Developer

    I’m not sure what you mean by spam? Are you just wanting to remove jQuery Migrate?


    Every time a page loads it prints a console.log, that’s what I mean by spam.

    Lead Developer
    Lead Developer

    Ah, that’s just something WordPress/jQuery Migrate does by default.

    That function you shared should remove it.

    Here’s another example: https://github.com/cedaro/dequeue-jquery-migrate/blob/develop/dequeue-jquery-migrate.php#L30-L36

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.