Skip to main content
Wordpress

• ▷ How to remove Gutenberg CSS from WordPress




<>

2knJzSe

The new Gutenberg editor has been an integral part of WordPress for over a year now, more precisely with the maintenance release 4.9.8 in August 2018.

Esta versión incluía una demo de Gutenberg y ya no era necesario que el Username la instalara activamente como plugin.

So all users could test the new editor before it was converted with WordPress 5.0. "Bebo" the new standard WordPress editor.

The only problem was that not all themes or plugins were ready to start Gutenberg and work with the new editor. Even Gutenberg himself was and is free from errors.

This led to major discussions within the WordPress community as well as various plugins disabling Gutenberg, ClassicPress, a fork of WordPress from the pre-Gutenberg era.

At this point, however, I don't want to go into the pros and cons of Gutenberg at all, but I would like to briefly show you what to watch out for when closing Gutenberg.

Al principio había algunos plugins que desactivaban el editor de Gutenberg. Mientras tanto, un plugin se ha establecido de forma clara si quiere o necesita ejecutar su sitio Web sin Gutenberg:

With over 5 million active installations (as of August 2019), the Classic Editor is the tool of choice.

1. Installation of Classic Editor

After installing and activating the plugin, you can globally set the editor as the default editor. The plugin does not come with complex configurations, but it controls the «Gutenberg or not» settings for your WordPress installation centrally under 'Write settings.

After installing the Classic Editor you can activate it in Settings' Write.

Después de cambiar con éxito al Classic Editor, su máscara de entrada tendrá el mismo aspecto que antes de la actualización de Gutenberg y todos los componentes, ya be tema, plugin, etc., funcionarán como de costumbre.

That's it, an old restored condition? Almost!

2. Remove the Gutenberg CSS

La actualización de WordPress desde la versión 5 trae consigo un defecto. Con la conversion a Gutenberg, los nuevos recursos (Javascript, CSS) al mismo tiempo se emiten en la interfaz.

As we have just exchanged the editor, we no longer need all the "Block CSS", which WordPress reproduces for us.

For Gutenberg the file wp-includes / css / dist / block-library / style.min.css con un tamaño de archivo de aproximadamente 30KB se carga en el frontend.

This is just an unnecessary drag on our solution without Gutenberg, because in times of performance optimization every byte and every request counts. You can find more information about performance optimization in WordPress here.

You can upload the file, but simply with the following code in the functions file.php to prevent:

add_action ('wp_enqueue_scripts', 'twp_remove_gutenberg_block_css', 100); function twp_remove_gutenberg_block_css () {wp_dequeue_style ('wp-block-library'); }

Running the code above instructs WordPress to remove the reference to wp-block-library-css and the file will no longer play automatically.

Por ende usted se ahorra una petición HTTP innecesaria y hace su sitio un poco más rápido.