\

How can I add code to my site’s header or footer?

If you have tracking code, custom CSS or JavaScript libraries, extra meta information, or anything else you’d like to add to your site’s <head> section, you can do so by copying and modifying this Code Snippet:

add_action( 'wp_head', function () { ?>

<!-- paste your <head> code here -->

<?php } );

Similarly, if you would like to add code wich is supposed to go in the site footer, just before the end of the <body> section, you would do so like this:

add_action( 'wp_footer', function () { ?>

<!-- paste your footer code here -->

<?php } );

Related Articles