Skip to content

Instantly share code, notes, and snippets.

@aiiddqd
Last active May 25, 2018 05:37
Show Gist options
  • Save aiiddqd/b99ef36aabab1ff641414e593e73d040 to your computer and use it in GitHub Desktop.
Save aiiddqd/b99ef36aabab1ff641414e593e73d040 to your computer and use it in GitHub Desktop.
Disable Gutenberg support for CPT 'product' in WooCommerce
<?php
/*
Plugin Name: Gutenberg - disable CPT
Description: Отключаем поддержку Gutenberg для постов типа Продукт
Author: uptimizt
Version: 1.0
Author URI: http://wpcraft.ru
*/
// Use hook return apply_filters( 'gutenberg_can_edit_post_type', $can_edit, $post_type );
function u7_gutenberg_disable_cpt($can_edit, $post_type){
if($post_type == 'product'){
$can_edit = false;
}
return $can_edit;
}
add_filter('gutenberg_can_edit_post_type', 'u7_gutenberg_disable_cpt', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment