Skip Navigation

[Resolved] Struggling to dequeue "toolset-common-es-frontend" from front-end

This support ticket is created 3 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.11 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Valeriia 3 years ago.

Assisted by: Luo Yang.

Author
Posts
#2195683

Hi,

I'm trying to remove the script "toolset-common-es-frontend.js" from loading in front-end where it's not needed at all:

I used the instructions from here: https://toolset.com/forums/topic/is-codemirror-really-needed-in-front-end/ to display all the Toolset scripts and thier handles.

I'm searching for 'common-es' in that list, and the only one I find is this one:

[cred-form-block-js] => Toolset_Script Object
(
[handle] => cred-form-block-js
[path] => hidden link.../cred-frontend-editor/public/js/blocks.editor.js
[deps] => Array
(
[0] => wp-editor
[1] => toolset-common-es
)
[ver] => 2.6.12
[in_footer] =>
)

It already does not look the same as the path is different (the one that's displayed is in "hidden link.../cred-frontend-editor/vendor/toolset/common-es/public/toolset-common-es-frontend.js").

Adding the handle to wp_enqueue_scripts does not do anything:

add_action( 'wp_enqueue_scripts', 'remove_default_scripts', 20 );
function remove_default_scripts() {
wp_dequeue_script( 'cred-form-block-js' );
wp_deregister_script( 'cred-form-block-js' );
}

This is the only toolset script that I can't manage to remove. Can you help please?

Thank you.

#2196459

Hello,

It needs custom codes, you can try the solution of below thread:
https://toolset.com/forums/topic/dequeue-unused-styles-and-scripts/#post-1861139

#2196639

Hello Luo Yang,

Thanks for the reply, but it's not working.

Here is my code (I added everything that was in the post you suggested, plus what I had before):

add_action( 'wp_enqueue_scripts', 'remove_default_scripts', 1, 999 );
  
function remove_default_scripts() {   
    
   wp_dequeue_script( 'toolset_select2' );
   wp_dequeue_script( 'toolset_select2' );
    wp_deregister_script( 'toolset_select2' );
    wp_dequeue_style( 'toolset-select2-css' );
    wp_deregister_style( 'toolset-select2-css' );
 
    wp_dequeue_script( 'toolset-codemirror-script' );
    wp_deregister_script( 'toolset-codemirror-script' );
    wp_dequeue_script( 'jquery-ui' );
    wp_dequeue_script( 'wptoolset-field-date' );
    wp_dequeue_script( 'cred-form-block-js' );
    wp_deregister_script( 'cred-form-block-js' );
   
    wp_dequeue_style( 'toolset-common-es' );
    wp_deregister_style( 'toolset-common-es' );
    wp_dequeue_script( 'toolset-common-es-frontend-js' );
    wp_deregister_script( 'toolset-common-es-frontend-js' );
    wp_dequeue_script( 'toolset-common-es-masonry' );

    wp_dequeue_script( 'wptoolset-field-date' );
    wp_dequeue_script( 'views-blocks-frontend' );
    wp_dequeue_style( 'toolset_blocks-style-css' );
    wp_deregister_style( 'toolset_blocks-style-css' );
    wp_dequeue_style( 'views-pagination-style' );
    wp_deregister_style( 'views-pagination-style' );
}

And I still see this in the page code:

<script type='text/javascript' src='.../cred-frontend-editor/vendor/toolset/common-es/public/toolset-common-es-frontend.js?ver=161000' id='toolset-common-es-frontend-js'></script>

How do I remove it?

Thanks

#2198549

Since it is a custom codes problem, please provide a test site with the same problem, also point out the problem page URL and where I can edit your custom PHP codes, I can setup a demo for you

#2201363

Thanks for the details, I have done below modifications in your website, edit 2019 theme file functions.php, add below codes in the bottom:

add_action( 'wp_enqueue_scripts', 'ts_dequeue_scripts', 1, 999 );
add_action( 'wp_print_scripts', 'ts_dequeue_scripts', 1, 99 );
add_action( 'wp_print_footer_scripts', 'ts_dequeue_scripts', 1, 99 );
function ts_dequeue_scripts(){
    if(is_admin()){ 
        return;
    }
    wp_dequeue_script( 'wptoolset-field-date' );
    wp_dequeue_script( 'views-blocks-frontend' );
    wp_dequeue_script( 'toolset-common-es-masonry' );
    wp_dequeue_script( 'toolset-common-es-frontend' ); // this line is for toolset-common-es-frontend.js
    wp_dequeue_style( 'toolset-common-es' );
    wp_deregister_style( 'toolset-common-es' );
    wp_dequeue_style( 'toolset_blocks-style-css' );
    wp_deregister_style( 'toolset_blocks-style-css' );
    wp_dequeue_style( 'views-pagination-style' );
    wp_deregister_style( 'views-pagination-style' );
    wp_dequeue_style( 'toolset-select2-css' );
    wp_deregister_style( 'toolset-select2-css' );
}

Above codes will remove all Toolset JS/CSS files from frontend, you can customize it as what you want.

#2205685

Hello Luo,

I see it's working. Thanks for your help.

Have a nice day!