Hi @infosion,
if you are using the block editor you can remove the inline scripts with this code:
add_action( 'init', function () {
$form = searchwp_live_search()->get( 'Form' );
remove_action( 'wp_footer', [ $form, 'gutenberg_integration' ] );
}, 20 );
That said, after looking more into this, I believe the Live Ajax Search functionality may break when dequeueing the scripts as suggested before.
This is because the scripts also needs to be localized with extra data. If you enqueue the scripts on your custom file the localization would not work.
My suggestion would be to let the Live Ajax Search load its own files and scripts but use the code below to limit them only on specific pages:
add_action( 'init', function () {
// List of post IDs where the Live Ajax Search should be loaded
$swp_live_ajax_pages = [123,456];
// If the current page is not in the list prevent the scripts from loading
if ( ! in_array( get_queried_object_id(), $swp_live_ajax_pages ) ) {
return;
}
$form = searchwp_live_search()->get( 'Form' );
remove_action( 'wp_footer', [ $form, 'gutenberg_integration' ] );
add_action( 'wp_enqueue_scripts', function () {
wp_dequeue_script( 'swp-live-search-client' );
}, 20 );
}, 10 );
I hope this helps!