M2P conflict with multi-select form field in Better Search Replace

When using the Better Search Replace plugin and M2P together, the multi-select field in Better search Replace breaks, preventing you from selecting all tables correctly.

  • Greg
    • The Exporter

    Hey SLS group,

    QUESTION: When this ticket was created, do you guys/gals see the live chat transcript that prompted this ticket for more context too? If not, let me know so I can provide more details. Here is a video, at least, so you have it: Here is my 5 min video explanation and demo of the issue https://www.screencast.com/t/XAFgp5ad9

    and . . .

    Here is more info from the Better Search and Replace developer here https://wordpress.org/plugins/better-search-replace/ FYI:
    "
    Hi Greg,

    This definitely sounds like a conflict, but not something that I think should be handled in Better Search Replace.

    Better Search Replace doesn't use Select2, which is separate Javascript library designed to add more functionality to HTML select elements.

    Instead BSR uses native HTML select elements, which means they should work in any browser without another library.

    It sounds like the Membership Pro 2 plugin is enqueuing their javascript (and the Select2 JS library) on all WordPress admin pages, which could likely be causing the conflict. The fix there would be to only include their javascript on their own plugin pages.

    Cheers,
    Matt
    "

    -----

    Let me know when you receive etc?

    Thanks.

    Greg

  • Kasia Swiderska
    • Support nomad

    Hey Greg,

    Yes, we do have access to chat transcript! I can see additional info. Also thanks for the message from Better Search developers. That really helps.
    I want to confirm that task for the SLS devs is created and all the info passed to them so they will take care of this issue.

    kind regards,
    Kasia

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Greg !

    Could you try adding this code into your functions.php ( child themes would be best ) please?

    function remove_select_from_bsnr( $hook ) {
    	if ( 'tools_page_better-search-replace' === $hook ) {
    		wp_dequeue_script( 'wpmu-select2-3-min-js' );
    		wp_dequeue_style( 'wpmu-select2-3-min-css' );
    	}
    }
    add_action( 'admin_enqueue_scripts', 'remove_select_from_bsnr', 15 );

    This will make sure to dequeue both the css/js from the Better Search & Replace admin page when viewed and you'll be able to see the select field normally.

    I have also informed our Devs about this for a permanent fix on an upcoming release.

    Tell me if this works for you!

    Regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.