@joemcplumber
You have to create a child theme from 2022. In that child theme copy the functions.php from the parent theme and then add the above code.
Here is my functions.php code where I’ve added Google Analytics code. You can copy this entire content and paste in your functions.php in child theme.
You can see it working on https://psychicdivinity.com/
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 11 );
function my_theme_enqueue_styles() {
wp_enqueue_style( 'child-style', get_stylesheet_uri() );
}
add_action('wp_head', 'header_code');
function header_code() {
echo '<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-NN2K5L"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag(\'js\', new Date()); gtag(\'config\', \'G-NN2K5L\');</script>';
}
add_filter( 'get_the_archive_title_prefix', '__return_false' );
Damn WordPress, they disabled my other www.ads-software.com account for no reason. Can you stop suspending accounts?