How to Remove Default Category Metabox in Custom Post Types

I have approached this situation by using jQuery and CSS (this is code from a project that’s been in production for a few years that I generalized):

// Admin Styles
function style_custom_taxonomy_admin() {
    if (is_admin() && $_GET['taxonomy'] === 'TAXONOMY') {
        add_action('admin_footer', function() {
            echo '<style>/* Custom admin styles */</style>';
            echo '<script>jQuery(document).ready(function($){
                $("h2:contains(\"Heading to be hidden\")").length.remove();
                $(".form_element_to_remove").remove();
                </script>
        });
    }
}
add_action('init', 'style_custom_taxonomy_admin');

If you do not need the default taxonomies, you can create your own to start off with a simpler interface.

// Register Custom Taxonomy
function THIS_custom_taxonomy() {
    register_taxonomy('TAXONOMY', ['post_type'], [
        'labels' => [
            'name' => 'TAXONOMY',
            'singular_name' => 'TAXONOMY',
            'menu_name' => 'TAXONOMY',
        ],
        'hierarchical' => false,
        'public' => true,
        'show_ui' => true,
    ]);
}
add_action('init', 'THIS_custom_taxonomy', 0);

Then you can add Taxonomy Meta (which you can also do with default taxonomies, of course):

// Edit Custom Taxonomy Meta
function add_custom_taxonomy_meta($term) {
    $term_meta = get_term_meta($term->term_id);
    ?>
    <h3>Custom Fields</h3>
    <input type="text" name="term_meta[field1]" value="<?= $term_meta['field1'][0] ?? '' ?>">
    <input type="text" name="term_meta[field2]" value="<?= $term_meta['field2'][0] ?? '' ?>">
    <?php
}
add_action('TAXONOMY_edit_form_fields', 'add_custom_taxonomy_meta');

{$taxonomy}_edit_form_fields

And save the custom meta fields:

// Save Custom Taxonomy Meta
function save_custom_taxonomy_meta($term_id) {
    if (!isset($_POST['term_meta'])) return;
    foreach ($_POST['term_meta'] as $key => $value) {
        update_term_meta($term_id, $key, $value);
    }
}
add_action('edited_TAXONOMY', 'save_custom_taxonomy_meta', 10, 2);

edited_{$taxonomy}

deneme bonusu veren sitelerbahis siteleripulibet girişdeneme bonusutürkçe altyazılı pornocanlı bahis casinocanlı bahis casino siteleriOnwin Güncel Girişholiganbetholiganbet girişholiganbet güncel girişnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnewsnews