首页 > 解决方案 > 从 WooCommerce 生成的产品帖子类型中删除 post_content

问题描述

我正在尝试删除下图中显示的第一个字段,但无法这样做。我已成功删除“产品简短描述”字段,但无法删除该post_content字段。

我试过的:

add_action('init', 'remove_content');
function remove_content() {
  remove_post_type_support('products', 'editor' );
}

在此处输入图像描述

标签: phpwordpresscustom-post-type

解决方案


你可以试试这个:

我认为 woocommerce 使用的帖子类型是product,您需要的操作是admin_init

add_action('admin_init', 'hide_editor');
        
function hide_editor() {
  remove_post_type_support('product', 'editor');
}

推荐阅读