• Resolved pimpiet

    (@pimpiet)


    Hi! Thanks for the plugin. I only use the plugin for indexing, so I don’t need the shortcodes and autocomplete. Is het possible te remove the scripts added by the plugin?

    I tried this but it is not working:

    add_action( 'init', 'remove_my_class_action' );
    function remove_my_class_action() {
    	remove_action( 'wp_footer', array( 'Frontend', 'load_php_templates' ));
    
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Hi @pimpiet .
    You shouldn’t be removing the footer.
    What you will need to do is remove the scripts.

    Please try the following code.

    function wpdocs_dequeue_script() {
    	wp_dequeue_script( 'cm-typesense-frontend' );
    }
    add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );
    
    function mywptheme_child_deregister_styles() {
    	wp_dequeue_style( 'cm-typesense-frontend' );
    	wp_dequeue_style( 'algolia-satellite' );
    
    }
    add_action( 'wp_enqueue_scripts', 'mywptheme_child_deregister_styles', 11 );
    Thread Starter pimpiet

    (@pimpiet)

    Hi @digamberpradhan thanks, that works!

    Is it also possible to remove the 4 inline scripts? For example this one:
    <script type="text/html" id="tmpl-cm-typesense-shortcode-default-search-results">.....

    Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Hi @pimpiet ,

    Please first update plugin to version 1.1.10 as we’ve updated/refactored some code
    Then please try the following code:

    add_action( 'init', 'cm_20220202_remove_tpl_scripts' );
    function cm_20220202_remove_tpl_scripts () {
    	remove_action( 'wp_footer', array( Codemanas\Typesense\Frontend\Frontend::getInstance(), 'load_php_templates' ), 10 );
    }
    Thread Starter pimpiet

    (@pimpiet)

    Hi @digamberpradhan,

    Thanks a lot for the update & code, it works!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to remove unused UI frontend scripts’ is closed to new replies.