How to remove Language neutral as an option programmatically and as a setting

This is how you can remove Language neutral as an option programmatically. Put the code snippet in your module.

<?php
 
function mymodule_form_alter(&$form, $form_state, $form_id) {
    if (
$form_id == 'node_type_form') {
      unset(
$form['language']['#options']['']);
    }
  }
?>

If you want to remove the option on a content type just mark Require language (Do not allow Language Neutral) in the edit view of content type in the fieldset Multilingual options

Knowledge keywords: