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

wp_logout function not executed

I also tested the code on a local sandbox WP and it worked as expected. As Howdy_McGee commented this is probably a conflict with 3rd party code. If disabling theme and plugins is not an option, you can try changing the priority of the actions – i.e. the third parameter to add_action(). By default priority … Read more