Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bobwol/21cc42d1e6a4d3173d8be23e1beb0615 to your computer and use it in GitHub Desktop.
Save bobwol/21cc42d1e6a4d3173d8be23e1beb0615 to your computer and use it in GitHub Desktop.

Revisions

  1. @claudiosanches claudiosanches revised this gist Nov 5, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions wc-products-disable-gutenberg.php
    Original file line number Diff line number Diff line change
    @@ -22,8 +22,8 @@
    */
    function wc_no_gutenberg_for_products( $is_enabled, $post_type ) {
    if ( 'product' === $post_type ) {
    return false;
    }
    return false;
    }

    return $is_enabled;
    }
  2. @claudiosanches claudiosanches revised this gist Nov 5, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wc-products-disable-gutenberg.php
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    <?php
    /**
    * Plugin Name: No Gutenberg for old versins of WooCommerce
    * Plugin URI: https://github.com/claudiosanches/slug
    * Plugin URI: https://gist.github.com/claudiosanches/d0231798eb6041e4911b4bca409ec1ac
    * Description: Disable Gutenberg in Edit Product screen for WooCommerce 3.4.x.
    * Author: Claudio Sanches
    * Author URI: https://claudiosanches.com
  3. @claudiosanches claudiosanches created this gist Nov 5, 2018.
    31 changes: 31 additions & 0 deletions wc-products-disable-gutenberg.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    <?php
    /**
    * Plugin Name: No Gutenberg for old versins of WooCommerce
    * Plugin URI: https://github.com/claudiosanches/slug
    * Description: Disable Gutenberg in Edit Product screen for WooCommerce 3.4.x.
    * Author: Claudio Sanches
    * Author URI: https://claudiosanches.com
    * Version: 1.0.0
    * License: GPLv3
    *
    * @package WC_No_Gutenberg
    */

    defined( 'ABSPATH' ) || exit;

    /**
    * Disable gutenberg for old versions of WooCommerce.
    *
    * @param bool $is_enabled If editor is enabled.
    * @param string $post_type Post type.
    * @return bool
    */
    function wc_no_gutenberg_for_products( $is_enabled, $post_type ) {
    if ( 'product' === $post_type ) {
    return false;
    }

    return $is_enabled;
    }

    add_filter( 'use_block_editor_for_post_type', 'wc_no_gutenberg_for_products', 10, 2 );