Skip to content

Instantly share code, notes, and snippets.

@lamanrasmi
Forked from gmmedia/functions.php
Created August 19, 2022 02:09
Show Gist options
  • Save lamanrasmi/3cbbb4da22b1b88c4f7809288a8d559e to your computer and use it in GitHub Desktop.
Save lamanrasmi/3cbbb4da22b1b88c4f7809288a8d559e to your computer and use it in GitHub Desktop.
Enable Gutenberg editor for WooCommerce
// Enable Gutenberg editor for WooCommerce
function j0e_activate_gutenberg_product( $can_edit, $post_type ) {
if ( $post_type == 'product' ) {
$can_edit = true;
}
return $can_edit;
}
add_filter( 'use_block_editor_for_post_type', 'j0e_activate_gutenberg_product', 10, 2 );
// Enable taxonomy fields for Woocommerce with Gutenberg on
function j0e_enable_taxonomy_rest( $args ) {
$args['show_in_rest'] = true;
return $args;
}
add_filter( 'woocommerce_taxonomy_args_product_cat', 'j0e_enable_taxonomy_rest' );
add_filter( 'woocommerce_taxonomy_args_product_tag', 'j0e_enable_taxonomy_rest' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment