php - Wordpress: Non hierarchical taxonomy to be select only one in edit posts

one text

Solution:

According to the scope of the question, you need to hook your JavaScript code to the "admin_enqueue_scripts" hook in this way:

// custom css and js
add_action('admin_enqueue_scripts', 'cstm_css_and_js');
 
function cstm_css_and_js() {
   wp_enqueue_style('admin_css', get_template_directory_uri().'/css/admin.css');
   wp_enqueue_script( 'admin-js', get_template_directory_uri().'/js/admin.js', array('jquery-core'), false, true );
}

And you should put your code inside the "admin.js" file.

this is the link to study more about this hook: https://developer.wordpress.org/reference/hooks/admin_enqueue_scripts/#:~:text=admin_enqueue_scripts%20is%20the%20proper%20hook,informs%20the%20current%20admin%20page.

But honestly, you need to focus on how you are going to apply your changes in the backend of your website.

Source