One of two Custom Post types not being registered

I have this function that adds to custom post types which is very simple and straight forward as seen below;

function create_hr_post_type() {

  register_post_type( 'informationtechnology',
    array(
      'labels' => array(
        'name' => __( 'Information Technology' ),
        'singular_name' => __( 'Information Technology' )
      ),
      'public' => true,
      'has_archive' => true,
      'rewrite' => array('slug' => 'informationtechnology'),
    )
  );

  register_post_type( 'humanresource',
    array(
      'labels' => array(
        'name' => __( 'HR' ),
        'singular_name' => __( 'HR' )
      ),
      'public' => true,
      'has_archive' => true,
      'rewrite' => array('slug' => 'humanresource'),
    )
  );


}

add_action( 'init', 'create_hr_post_type' );

However, only one post type is being registered on checking my admin left bar. I only see the the HR post type! What is going on in here? What i’m i missing?

I have tried reordering the code so that the IT type comes first but still doesn’t work.

Solutions Collecting From Web of "One of two Custom Post types not being registered"

An important notice from the Codex:

Do pay close attention to not having your custom post type identifier
exceed 20 characters though, as the post_type column in the database
is currently a VARCHAR field of that length.

Please check out:

echo strlen( 'informationtechnology' );

If you have WP_DEBUG activated, then you will see this warning:

register_post_type was called incorrectly. Post type names must be
between 1 and 20 characters in length. Please see Debugging in
WordPress for more information. (This message was added in version
4.2.)

so this is a good reminder to use it when developing your site 😉

This part of register_post_type() is responsible for this check, I missed it when I first skimmed through the function but confirmed it when I ran the example by @JoeyNg’ethe:

if ( empty( $post_type ) || strlen( $post_type ) > 20 ) {
    _doing_it_wrong(
        __FUNCTION__, 
        __( 'Post type names must be between 1 and 20 characters in length.' ), 
       '4.2' 
    );
    return new WP_Error( 
        'post_type_length_invalid',
        __( 'Post type names must be between 1 and 20 characters in length.' ) 
    );
}

EDIT

Look at the $post_type parameter when registering your post type

$post_type

(string) (required) Post type. (max. 20 characters, cannot contain
capital letters or spaces
)

Default: None