Reputation: 1
When I tried to add code on on Twenty Twenty-Two theme I could not find header.php as it not uses like this pattern. Please tell me where to find the file and if the file is absent where to find the tag to add something inside the tag.
Upvotes: 0
Views: 2613
Reputation: 45
In the WordPress documentation for block themes like Twenty Twenty-Two, <head>
is added automatically. Adding code, for example, Google Analytics, is recommended through a plugin.
or wp_head hook, added to function.php preferably child theme:
function hook_javascript() {
?>
<script>
alert('Page is loading...');
</script>
<?php
}
add_action('wp_head', 'hook_javascript');
Upvotes: 3