Is changing theme helps reducing CLS?

Hi,

I am using a lightweight theme that is pure Java Script but I am facing the issue of CLS. First, it was due to Auto Ads which I have disabled. That helped in reducing CLS but still showing error in Search Consol.

My question is do changing theme help in reducing CLS.

Thanks in advance.

There are lots of factors that can affect cls and theme is one of them…

If your theme has moving elements, dialogue box, popups or anything that can make the content move from its place then cls is going to be high.

Another common problem is missing height and width attributes of images. This causes cls issues as well.

Get instant 30% improvement using this plug-in

I Will check this. Saurav

When I am testing in Lighthouse even with throttle speed CLS is almost zero but in Search Consol, it is more than 0.5. So really getting frustrated.

I didn’t disable but instead using classic editor plugin.

If disable Gutenberg will it increase the performance?

Does your source code contains wp-includes/css/dist/block-library/style.min.css? and, are you using Classic Editor?

(The block Editor CSS is often unused for the Classic Editor user. It affects the intial page load time.)

Then you should install above plugin. Alternatively, use this filter.

I did a CTRL+U source code check but didn’t find the above code that you mentioned.

Should I add the below code in functions.php file?

// remove block css
function remove_block_css() {
wp_dequeue_style( ‘wp-block-library’ );
}
add_action( ‘wp_enqueue_scripts’, ‘remove_block_css’, 20 );

// disable for posts
add_filter(‘use_block_editor_for_post’, ‘__return_false’, 10);

// disable for post types
add_filter(‘use_block_editor_for_post_type’, ‘__return_false’, 10);

You should not add that code snippet in theme functions.php because when you’ll update your theme it will be vanished. Therefore, use Code Snippets plugin to manage all snippets at one place.

Thanks bro. Will check that.

You’re welcome!