PluginProbe
Classic Editor + / 4.3.0
Classic Editor + v4.3.0
4.4.2 trunk 1.4.0 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.4.0 2.5.0 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 3.0.0 3.0.1 3.1.0 4.0.1 4.0.2 4.1.0 4.1.1 4.2.0 4.3.0 All 27 releases
classic-editor-addon / classic-editor-addon.php

classic-editor-addon.php in Classic Editor + 4.3.0, at classic-editor-addon.php

95 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Classic Editor +
4 * Description: The "Classic Editor +" plugin disables the block editor, removes enqueued scripts/styles and brings back classic Widgets.
5
6 * Author: <a href="https://so-wp.com">Pieter Bos</a>, <a href="https://gschoppe.com">Greg Schoppe</a>
7 * Version: 4.3.0
8
9 * Requires at least: 4.9
10 * Tested up to: 6.4
11
12 * License: GPL-3.0+
13 * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
14
15 * Text Domain: classic-editor-addon
16
17 * GitHub Plugin URI: https://github.com/senlin/classic-editor-addon
18 * GitHub Branch: master
19
20 * @package WordPress
21 * @author Pieter Bos &amp; GSchoppe
22 * @since 1.0.0
23 */
24
25 // don't load the plugin file directly
26 if ( ! defined( 'ABSPATH' ) ) exit;
27
28 // deactivate Classic Editor plugin
29 add_action( 'admin_init', 'cea_deactivate_ce' );
30 function cea_deactivate_ce() {
31 if ( is_admin() && current_user_can( 'activate_plugins' ) && is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
32
33 deactivate_plugins( 'classic-editor/classic-editor.php' );
34
35 }
36 }
37
38 add_action( 'enqueue_block_assets', 'cea_remove_block_styles', 100 );
39
40 function cea_remove_block_styles() {
41
42 wp_dequeue_style( 'wp-block-library' );
43 wp_deregister_style( 'wp-block-library' );
44
45 wp_dequeue_style( 'wp-block-library-theme' );
46 wp_deregister_style( 'wp-block-library-theme' );
47
48 // Remove inline global CSS on the front end.
49 wp_dequeue_style( 'global-styles' );
50 wp_deregister_style( 'global-styles' );
51
52 // @2.5.0 add condition that checks for WooCommerce and removes call to block styles
53 if ( class_exists( 'woocommerce' ) ) {
54 wp_dequeue_style( 'wc-blocks-style' );
55 wp_dequeue_style( 'wc-all-blocks-style' );
56 wp_dequeue_style( 'wc-blocks-vendors-style' );
57 wp_deregister_style( 'wc-blocks-style' );
58 wp_deregister_style( 'wc-all-blocks-style' );
59 wp_deregister_style( 'wc-blocks-vendors-style' );
60 }
61
62 }
63
64 // Remove global styles and enqueueing of classic-themes.min.css
65 remove_action( 'wp_enqueue_scripts', 'wp_enqueue_classic_theme_styles' );
66 remove_action('wp_enqueue_scripts', 'wp_enqueue_global_styles');
67 remove_action('wp_body_open', 'wp_global_styles_render_svg_filters');
68
69 // Disable Gutenberg on the back end.
70 add_filter( 'use_block_editor_for_post', '__return_false' );
71
72 /**
73 * Bring back Classic Widgets
74 *
75 * @since 3.1.0
76 * @src: https://plugins.svn.wordpress.org/classic-widgets/tags/0.3/classic-widgets.php
77 */
78 // Disable the block editor from managing widgets in the Gutenberg plugin.
79 add_filter( 'gutenberg_use_widgets_block_editor', '__return_false' );
80 // Disable the block editor from managing widgets.
81 add_filter( 'use_widgets_block_editor', '__return_false' );
82
83 /**
84 * Disable block styling that WPML adds to every page load regardless of whether Blocks are being used.
85 * file that loads these styles: classes/block-editor/Loader.php (L25 & L77-84)
86 */
87 add_action( 'wp_enqueue_scripts', 'cea_disable_wpml_block_styles', 11 );
88
89 function cea_disable_wpml_block_styles() {
90 // Check if WPML is active and the WPML\BlockEditor\Loader class exists
91 if ( function_exists( 'is_plugin_active' ) && is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) && class_exists( 'WPML\BlockEditor\Loader' ) ) {
92 wp_deregister_style( WPML\BlockEditor\Loader::SCRIPT_NAME );
93 }
94 }
95