我使用的主题是使用register_post_type 和\'taxonomies\' => array(\'portfolio-cat\') 作为论点之一。
我需要使用register_post_type_args.
我尝试过:
add_filter( \'register_post_type_args\', \'change_portfolio_post_type_args\', 10, 2 );
function change_portfolio_post_type_args( $args, $post_type ) {
if ( \'portfolio\' === $post_type ) {
unset($args[\'taxonomies\']); // Not working
unset($args[\'taxonomies\'][0]); // Not working
$args[\'taxonomies\'] = array(); // Not working
$args[\'taxonomies\'] = array(\'category\'); // It justs add another taxonomy
}
return $args;
}
如何在不接触主题核心文件的情况下删除它?