Genx Japanese Blog

ビートメイカー。音楽とアートを制作しています。

WooCommerceでGutenberg Editorを有効にする方法

Genx Beatsのアバター
シェアする:

以下のコードfunctions.phpに入れて保存するとWooCommerceGutenberg Editorが使えるようになる。

// WoocommerceでGutenbergを有効にする
function 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', 'activate_gutenberg_product', 10, 2 );

// Gutenbergをオンにして woocommerce のタクソノミーフィールドを有効にする
function enable_taxonomy_rest( $args ) {
    $args['show_in_rest'] = true;
    return $args;
}
add_filter( 'woocommerce_taxonomy_args_product_cat', 'enable_taxonomy_rest' );
add_filter( 'woocommerce_taxonomy_args_product_tag', 'enable_taxonomy_rest' );

最終更新日:

コメント

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

3 × 3 =