WordPress at a glance

wp_footer() WP 1.5.1

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>.

See wp_head() — a similar function that runs the wp_head hook in the theme header.

Works based on: do_action()
Hooks from the function
Return

Null. Nothing.

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.

Code of wp footer: wp-includes/general-template.php WP 5.2.3

<?php
function wp_footer() {
	/**
	 * Prints scripts or data before the closing body tag on the front end.
	 *
	 * @since 1.5.1
	 */
	do_action( 'wp_footer' );
}

Related Functions

From category: Other Theme Functions

More from Template Tags: Main Functions

No comments
    Hello, !     Log In . Register