4

WP如何禁用小工具区块编辑模式 WordPress5.8版本开始禁止小工具区块编辑模式方法

 2 years ago
source link: https://www.huhexian.com/5287.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

WP如何禁用小工具区块编辑模式 WordPress5.8版本开始禁止小工具区块编辑模式方法

青山 2021-10-1813:57:07评论578字

很多朋友升级WordPress到5.8版本之后是不是看到小工具模块是有变动了,默认的在后台小工具里面采用了古腾堡编辑器来管理,一些老主题可能会出现兼容问题,导致在进行小工具设置的时候页面打不开或者打开后白屏。小工具也是采用的古登堡编辑模式,这个体验确实我也不喜欢,那我们如何禁止掉这种编辑器小工具方式呢?下面就来给朋友们介绍下WordPress5.8版本开始禁止小工具区块编辑模式的两种方法。

WP如何禁用小工具区块编辑模式 WordPress5.8版本开始禁止小工具区块编辑模式方法

第一、禁止小工具模块化

  1. function example_theme_support() {
  2. remove_theme_support( 'widgets-block-editor' );
  3. }
  4. add_action( 'after_setup_theme', 'example_theme_support' );

禁止后,我们可以看到小工具还是原来习惯的模式。

第二、安装插件Classic Widgets

安装这个插件之后,小工具的编辑模式还是和原来一样传统模式。或者我们用代码禁止

  1. add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );
  2. add_filter( 'use_widgets_block_editor', '__return_false' );

有很多的主题不支持兼容这个小工具编辑模式,所以我们还是去掉比较好。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK