Prevent publishing of uncategorized posts
The in_category function works only on existing (saved) posts. Here you can directly access the category in $postarr like this: if (‘affitti’ == $postarr[‘post_category’])) { wp_die(‘Error: Posts cannot be published with the default category.’); } By the way, are you sure you want to use wp_die for this and not some other error message? People … Read more