• I’m testing out this plugin on a site that already uses Backbone views on most pages (including the one where search appears) and this plugin seems to be causing a conflict.

    I’m getting a Chrome console error ‘Uncaught Error: Backbone.history has already been started’ on pages using Backbone that have search forms, and all JS is broken for those pages.

    Any advice? In a future version of this plugin, you may want to consider using Backbone in a way that doesn’t conflict with sites already using it.

    https://ww.wp.xz.cn/plugins/wp-ultimate-search/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    WPUS uses the default backbone bundled with WordPress, so it shouldn’t cause any conflicts unless the plugin or theme you are using is doing something unusual (or maybe not using the default WP backbone.)

    You can manually handle any script registrations using WordPress’ enqueuing system, first disable all scripts in WPUS:

    global $wp_ultimate_search;
    remove_action( 'wp_enqueue_scripts', array( $wp_ultimate_search, 'register_scripts' ) );

    But then you would have to make sure all required scripts are properly enqueued on your own. Look at the code for register_scripts() if you want to do this.

    Thread Starter MadysonDesigns

    (@madysondesigns)

    Thanks for the info. However, I tried deregistering your version of Backbone to use my own and it’s still not working- same error.

    I think the conflict is actually initializing the Backbone history when it’s already started, not the Backbone file itself.

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    Ok. Can you provide a link?

    Thread Starter MadysonDesigns

    (@madysondesigns)

    I’ve only started working on this locally- it doesn’t exist anywhere in testing or production yet.

    Is there anything I can do to troubleshoot locally?

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    Do you know what other plugin is using Backbone? Or theme?

    Thread Starter MadysonDesigns

    (@madysondesigns)

    I have a custom theme that is using Backbone throughout. I’ve implemented it all myself.

    Plugin Author Mindshare Labs, Inc.

    (@mindshare)

    In that case it’s pretty hard to test it unless you make it accessible on the web someplace.

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

The topic ‘Using on existing Backbone site’ is closed to new replies.