The reason for this issue is that sometimes the wp_head() function is mistakenly placed after the head tag in the code snippet below:
<html <?php language_attributes(); ?>>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<?php wp_head(); ?
The correct approach is to position the wp_head() function before the closing head tag as shown in the code snippet below:
<html <?php language_attributes(); ?>>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php wp_head(); ?
</head>