taxonomy – Tags hierarchical – WordPress Development Stack Exchange

Question

I changed the default code in the wp-includes/taxonomy.php file to:

                            register_taxonomy(
            'post_tag',
            'post',
            array(
                    'hierarchical'          => true, //false, <--------- this line has been changed
                    'query_var'             => 'tag',
                    'rewrite'               => $rewrite['post_tag'],
                    'public'                => true,
                    'show_ui'               => true,
                    'show_admin_column'     => true,
                    '_builtin'              => true,
                    'capabilities'          => array(
                            'manage_terms' => 'manage_post_tags',
                            'edit_terms'   => 'edit_post_tags',
                            'delete_terms' => 'delete_post_tags',
                            'assign_terms' => 'assign_post_tags',
                    ),
                    'show_in_rest'          => true,
                    'rest_base'             => 'tags',
                    'rest_controller_class' => 'WP_REST_Terms_Controller',
            )
    );

However, now I’m getting two “category” taxonomies instead of “post_tag” and “category” in the wp-admin! Why is this? How can I make tags hierarchical?

Here’s a proof on the image – 2x Categories after changing one setting “hierarchical” as mentioned above from “false” to “true” in the post_tag:

Two Category taxonomies after changing post_tag settings!!!

0
forsberg 2 months 2022-06-26T11:19:54-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse