Skip to:
Content
Pages
Categories
Search
Top
Bottom

wp_deregister_script jquery removes Buddypress js


  • Lumartist
    Participant

    @lumartist

    Hey there,

    when I try to deregister the core jquery via

    wp_deregister_script( 'jquery' );

    it removes all buddypress-js files too. Not sure why this is happening. As soon as I uncomment wp_deregister_script on my functions.php I can find the buddypress-js files again via source code.

    Is there any way to avoid this?

    Thanks for your help in adavance!

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

  • Venutius
    Moderator

    @venutius

    Hi there,

    I think that the buddypress.js files have jquery listed as a dependency and you are removing jquery so they won’t load.


    Venutius
    Moderator

    @venutius

    Are you looking to load a more up to date version of jquery?


    Lumartist
    Participant

    @lumartist

    Are you looking to load a more up to date version of jquery?

    Exactly.

    This is the whole code I am using:

    function replace_core_jquery_version() {
      wp_deregister_script( 'jquery' );
      wp_register_script( 'jquery-new', get_template_directory_uri() . '/js/jquery.min.js', array(), '3.3.1', true );
      wp_deregister_script( 'jquery-migrate' );
      wp_enqueue_script('jquery-new');
    }
    add_action( 'wp_enqueue_scripts', 'replace_core_jquery_version' );

    Venutius
    Moderator

    @venutius

    I think you’ll have to call your version of jQuery “jquery” instead of “jquery-new” otherwise nothing that’s dependent on jquery will load.


    Lumartist
    Participant

    @lumartist

    Thanks a ton Venutius. That did the trick. Never thought of that. Sometimes the solution can be so simple…

    Thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Skip to toolbar