Skip to content

Instantly share code, notes, and snippets.

@FesoVel
Created January 4, 2019 12:48
Show Gist options
  • Save FesoVel/c60cd8727948e536b094b1d8e21e21c5 to your computer and use it in GitHub Desktop.
Save FesoVel/c60cd8727948e536b094b1d8e21e21c5 to your computer and use it in GitHub Desktop.
How to add html code to WordPress <head> using wp_head hook.
function insert_html_in_header() {
echo '<<< html here >>>';
}
/* Admin Dashboard */
add_action( 'admin_head', 'insert_html_in_header' );
/* Front End */
add_action( 'wp_head', 'insert_html_in_header' );
@dragonee
Copy link

dragonee commented Feb 2, 2023

If you're developing a theme, you can add this code to the functions.php file of your theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment