Disable Gutenberg - Version 1.8

Version Description

To upgrade this plugin, remove the old version and replace with the new version. Or just click "Update" from the Plugins screen and let WordPress do it for you automatically.

Note: uninstalling the plugin from the WP Plugins screen results in the removal of all settings and data from the WP database.

Download this release

Release Info

Developer specialk
Plugin Icon 128x128 Disable Gutenberg
Version 1.8
Comparing to
See all releases

Code changes from version 1.7 to 1.8

disable-gutenberg.php CHANGED
@@ -9,10 +9,10 @@
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.9
12
- Tested up to: 5.1
13
- Stable tag: 1.7
14
- Version: 1.7
15
- Requires PHP: 5.2.4
16
  Text Domain: disable-gutenberg
17
  Domain Path: /languages
18
  License: GPL v2 or later
@@ -69,7 +69,7 @@ if (!class_exists('DisableGutenberg')) {
69
 
70
  function constants() {
71
 
72
- if (!defined('DISABLE_GUTENBERG_VERSION')) define('DISABLE_GUTENBERG_VERSION', '1.7');
73
  if (!defined('DISABLE_GUTENBERG_REQUIRE')) define('DISABLE_GUTENBERG_REQUIRE', '4.9');
74
  if (!defined('DISABLE_GUTENBERG_AUTHOR')) define('DISABLE_GUTENBERG_AUTHOR', 'Jeff Starr');
75
  if (!defined('DISABLE_GUTENBERG_NAME')) define('DISABLE_GUTENBERG_NAME', __('Disable Gutenberg', 'disable-gutenberg'));
@@ -83,11 +83,11 @@ if (!class_exists('DisableGutenberg')) {
83
 
84
  function includes() {
85
 
 
86
  require_once DISABLE_GUTENBERG_DIR .'inc/plugin-core.php';
87
 
88
  if (is_admin()) {
89
 
90
- require_once DISABLE_GUTENBERG_DIR .'inc/classic-editor.php';
91
  require_once DISABLE_GUTENBERG_DIR .'inc/resources-enqueue.php';
92
  require_once DISABLE_GUTENBERG_DIR .'inc/settings-display.php';
93
  require_once DISABLE_GUTENBERG_DIR .'inc/settings-register.php';
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.9
12
+ Tested up to: 5.2
13
+ Stable tag: 1.8
14
+ Version: 1.8
15
+ Requires PHP: 5.6.20
16
  Text Domain: disable-gutenberg
17
  Domain Path: /languages
18
  License: GPL v2 or later
69
 
70
  function constants() {
71
 
72
+ if (!defined('DISABLE_GUTENBERG_VERSION')) define('DISABLE_GUTENBERG_VERSION', '1.8');
73
  if (!defined('DISABLE_GUTENBERG_REQUIRE')) define('DISABLE_GUTENBERG_REQUIRE', '4.9');
74
  if (!defined('DISABLE_GUTENBERG_AUTHOR')) define('DISABLE_GUTENBERG_AUTHOR', 'Jeff Starr');
75
  if (!defined('DISABLE_GUTENBERG_NAME')) define('DISABLE_GUTENBERG_NAME', __('Disable Gutenberg', 'disable-gutenberg'));
83
 
84
  function includes() {
85
 
86
+ require_once DISABLE_GUTENBERG_DIR .'inc/classic-editor.php';
87
  require_once DISABLE_GUTENBERG_DIR .'inc/plugin-core.php';
88
 
89
  if (is_admin()) {
90
 
 
91
  require_once DISABLE_GUTENBERG_DIR .'inc/resources-enqueue.php';
92
  require_once DISABLE_GUTENBERG_DIR .'inc/settings-display.php';
93
  require_once DISABLE_GUTENBERG_DIR .'inc/settings-register.php';
inc/plugin-core.php CHANGED
@@ -2,6 +2,16 @@
2
 
3
  if (!defined('ABSPATH')) exit;
4
 
 
 
 
 
 
 
 
 
 
 
5
  function disable_gutenberg_init() {
6
 
7
  if (disable_gutenberg()) disable_gutenberg_remove();
@@ -314,7 +324,7 @@ function disable_gutenberg_whitelist_id($post_id = false) {
314
 
315
  $post_id = disable_gutenberg_get_post_id($post_id);
316
 
317
- if (is_admin() && !empty($post_id)) {
318
 
319
  $options = disable_gutenberg_get_options();
320
 
@@ -338,7 +348,7 @@ function disable_gutenberg_whitelist_slug($post_id = false) {
338
 
339
  $status = get_post_status($post_id);
340
 
341
- if (is_admin() && !empty($post_id) && $status === 'publish') {
342
 
343
  $post = get_post($post_id);
344
 
@@ -364,7 +374,7 @@ function disable_gutenberg_whitelist_title($post_id = false) {
364
 
365
  $post_id = disable_gutenberg_get_post_id($post_id);
366
 
367
- if (is_admin() && !empty($post_id)) {
368
 
369
  $title = strtolower(get_the_title($post_id));
370
 
2
 
3
  if (!defined('ABSPATH')) exit;
4
 
5
+ function disable_gutenberg_get_options() {
6
+
7
+ global $DisableGutenberg;
8
+
9
+ $default = $DisableGutenberg->options();
10
+
11
+ return get_option('disable_gutenberg_options', $default);
12
+
13
+ }
14
+
15
  function disable_gutenberg_init() {
16
 
17
  if (disable_gutenberg()) disable_gutenberg_remove();
324
 
325
  $post_id = disable_gutenberg_get_post_id($post_id);
326
 
327
+ if (!empty($post_id)) {
328
 
329
  $options = disable_gutenberg_get_options();
330
 
348
 
349
  $status = get_post_status($post_id);
350
 
351
+ if (!empty($post_id) && $status === 'publish') {
352
 
353
  $post = get_post($post_id);
354
 
374
 
375
  $post_id = disable_gutenberg_get_post_id($post_id);
376
 
377
+ if (!empty($post_id)) {
378
 
379
  $title = strtolower(get_the_title($post_id));
380
 
inc/plugin-frontend.php CHANGED
@@ -2,13 +2,15 @@
2
 
3
  function disable_gutenberg_wp_enqueue_scripts() {
4
 
5
- // TODO: conditional enable/disable based on plugin settings
 
 
6
 
7
  $options = get_option('disable_gutenberg_options');
8
 
9
  $enable = isset($options['styles-enable']) ? $options['styles-enable'] : false;
10
 
11
- if (!$enable) {
12
 
13
  wp_dequeue_style('wp-block-library');
14
  wp_dequeue_style('wp-block-library-theme');
2
 
3
  function disable_gutenberg_wp_enqueue_scripts() {
4
 
5
+ global $wp_query;
6
+
7
+ $post_id = $wp_query->post->ID;
8
 
9
  $options = get_option('disable_gutenberg_options');
10
 
11
  $enable = isset($options['styles-enable']) ? $options['styles-enable'] : false;
12
 
13
+ if (!$enable && !disable_gutenberg_whitelist($post_id)) {
14
 
15
  wp_dequeue_style('wp-block-library');
16
  wp_dequeue_style('wp-block-library-theme');
inc/settings-register.php CHANGED
@@ -2,16 +2,6 @@
2
 
3
  if (!defined('ABSPATH')) exit;
4
 
5
- function disable_gutenberg_get_options() {
6
-
7
- global $DisableGutenberg;
8
-
9
- $default = $DisableGutenberg->options();
10
-
11
- return get_option('disable_gutenberg_options', $default);
12
-
13
- }
14
-
15
  function disable_gutenberg_register_settings() {
16
 
17
  // register_setting( $option_group, $option_name, $sanitize_callback );
2
 
3
  if (!defined('ABSPATH')) exit;
4
 
 
 
 
 
 
 
 
 
 
 
5
  function disable_gutenberg_register_settings() {
6
 
7
  // register_setting( $option_group, $option_name, $sanitize_callback );
readme.txt CHANGED
@@ -9,10 +9,10 @@ Author URI: https://plugin-planet.com/
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.9
12
- Tested up to: 5.1
13
- Stable tag: 1.7
14
- Version: 1.7
15
- Requires PHP: 5.2.4
16
  Text Domain: disable-gutenberg
17
  Domain Path: /languages
18
  License: GPL v2 or later
@@ -290,6 +290,13 @@ Thank you to everyone for using Disable Gutenberg and for all the [awesome 5-sta
290
  Version 1.5 brings some great new features and improvements. Note that better Multisite support is being developed for a future release. If you have any feedback or suggestions to make this plugin the absolute best it can be, and/or would like to help with development, please reach me via my [contact form](https://perishablepress.com/contact/) at Perishable Press.
291
 
292
 
 
 
 
 
 
 
 
293
  **1.7 (2019/03/06)**
294
 
295
  * Fixes bug with empty titles reverting to Gutenberg
9
  Donate link: https://monzillamedia.com/donate.html
10
  Contributors: specialk
11
  Requires at least: 4.9
12
+ Tested up to: 5.2
13
+ Stable tag: 1.8
14
+ Version: 1.8
15
+ Requires PHP: 5.6.20
16
  Text Domain: disable-gutenberg
17
  Domain Path: /languages
18
  License: GPL v2 or later
290
  Version 1.5 brings some great new features and improvements. Note that better Multisite support is being developed for a future release. If you have any feedback or suggestions to make this plugin the absolute best it can be, and/or would like to help with development, please reach me via my [contact form](https://perishablepress.com/contact/) at Perishable Press.
291
 
292
 
293
+ **1.8 (2019/04/28)**
294
+
295
+ * Bumps [minimum PHP version](https://codex.wordpress.org/Template:Server_requirements) to 5.6.20
296
+ * Fixes bug with block stylesheets and whitelisted posts
297
+ * Updates default translation template
298
+ * Tests on WordPress 5.2
299
+
300
  **1.7 (2019/03/06)**
301
 
302
  * Fixes bug with empty titles reverting to Gutenberg