wp_footer()
Fires the wp_footer action. This is one of the most important hooks, many plugins will not work without it. It needs to be called in the theme footer, in footer.php file.
This template tag should be placed right before the closing HTML tag </body>.
Uses: do_action()
Hooks from the function
Return
null
. Nothing (null).
Usage
<?php wp_footer(); ?>
Examples
#1 Required code in the footer of any theme
This example is taken from the default twentyten theme: wp-content/themes/twentyten/footer.php:
... <?php /** * Always use wp_footer() before </body> close tag * otherwise, many plugins will not work correctly because * they use this hook to add their's JS and other codes. */ wp_footer(); ?> </body> </html>
Changelog
Since 1.5.1 | Introduced. |
wp_footer() wp footer code WP 6.7.1
function wp_footer() { /** * Prints scripts or data before the closing body tag on the front end. * * @since 1.5.1 */ do_action( 'wp_footer' ); }