在主题下的functions.php文件在加入以下代码,可以同时关闭古滕堡(Gutenberg)编辑器以及首页等加载styles和js:
- /*关闭古滕堡编辑器 */
- add_filter('use_block_editor_for_post', '__return_false', 10);
- add_filter('use_widgets_block_editor', '__return_false', 10);
- function brain1981_remove_wp_block_library_css(){
- //WP Core
- wp_dequeue_style( 'wp-block-library' );
- wp_dequeue_style( 'wp-block-library-theme' );
- //WooCommerce
- wp_dequeue_style( 'wc-blocks-vendors-style' );
- wp_dequeue_style( 'wc-blocks-style' );
- wp_dequeue_style( 'wc-block-editor' );
- //BuddyPress
- wp_dequeue_style( 'bp-member-block' );
- wp_dequeue_style( 'bp-members-block' );
- }
- add_action( 'wp_enqueue_scripts', 'brain1981_remove_wp_block_library_css', 100 );