To disable custom fields except on category pages, how would I check if it's a category page?
Maybe it would be like this:
add_action( 'admin_menu', 'remove_custom_fields' );
function remove_custom_fields() {
if( /* code to check if page is not category page */){
remove_meta_box('postcustom', 'page', 'normal');
}
But I don't know how to do the check - I tried with
$screen = get_current_screen();
if($screen->taxonomy != 'category') { //etc}
but that didn't seem to work in the admin_menu
action, but I could use it with the current_screen
action, but that's the wrong place to remove the custom fields I guess.
---- EDIT ----
I realized that the category pages does not seem to have custom fields available , so it won't actually matter if I exclude the category pages from the removing of custom fields.