WordPress 5.2 action 'wp_body_open' not working

Hello,
I want to integrate google analytics script code at my body-tag. Thus I am using the wp_body_open action to integrate the code, as it should work with wordpress 5.2.x.
But it seems your theme, X, is not supporting this feature, since the following code:

function add_svacode_to_body() {
	?>
	<!-- sva code in body? -->
    <?php
 }
 add_action( 'wp_body_open', 'add_svacode_to_body' );

is not working. Although integrated within the functions.php file of my X-Child Theme,
How is the proper way to integrate my code snipped right after the body-tag.

Thanks for your help!

Hey Nimue,

Thanks for writing in!

I can confirm that the code will not work because the wp_body_open() action hook was not present in the theme. I already added it to our enhancement lists. To make your code work, please update it and use this one instead:

function add_svacode_to_body() {
	?>
	<!-- sva code in body? -->
    <?php
 }
 add_action( 'x_after_body_begin', 'add_svacode_to_body' );

We would love to know if this has worked for you. Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.