Hello friends, welcome to my another blog post how to enqueue inline scripts in header WordPress. Before writing this blog I had a big question in my mind that we can enqueue js, css files using wp_enqueue_script and wp_enqueue_style functions. But If we want to enqueue(add) inline js scripts in our theme’s header file using functings.php the how to do that. How we can enqueue inline js scripts in header? So for you people I have a solution. Please follow the below code:
Copy the below code to your theme’s functions.php and change accordingly to your requirements.
Enqueue inline scripts in header
Here I enqueue two inline js script using hook(wp_head). Try the above code. This will solve your problem. Now you know how to enqueue inline scripts in header WordPress. If you have any question or suggestion please comment below. If you like my post then please share it with your friends. Thank you.