Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 1 voice.

Last updated by Pieter 1 year, 11 months ago.

Author Posts
March 28, 2023 at 12:36 pm #13349229

Pieter

WPML comes with constants to not load scripts and styles of the language switcher in case a theme does something different (https://wpml.org/documentation/support/wpml-coding-api/#disabling-wpmls-css-and-js-files).

I'm looking to further optimise my site and I see that WPML also loads Blocks styling, a file of 11KB (wp-content/plugins/sitepress-multilingual-cms/dist/css/blocks/styles.css). As my site doesn't use the Block Editor, that file is redundant and I want to disable loading it.

Is there a constant available to disable this?

If not, can you tell me where it is enqueued, so I can perhaps write a function to remove it myself?

Thanks!

March 28, 2023 at 3:24 pm #13350749

Pieter

Found the solution myself, for others interested:

function prefix_disable_wpml_block_styles() {
    if ( class_exists( 'WPML\BlockEditor\Loader' ) ) {
        wp_deregister_style( WPML\BlockEditor\Loader::SCRIPT_NAME );
    }
}

add_action( 'wp_enqueue_scripts', 'prefix_disable_wpml_block_styles', 11 );