Title: wp_footer
Published: April 25, 2014
Last modified: February 24, 2026

---

# wp_footer()

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#wp--skip-link--target)

Fires the wp_footer action.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#description)󠁿

See [‘wp_footer’](https://developer.wordpress.org/reference/hooks/wp_footer/).

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#source)󠁿

    ```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' );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/general-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/general-template.php#L3207)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L3207-L3214)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#hooks)󠁿

 [do_action( ‘wp_footer’ )](https://developer.wordpress.org/reference/hooks/wp_footer/)

Prints scripts or data before the closing body tag on the front end.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#related)󠁿

| Uses | Description | 
| [do_action()](https://developer.wordpress.org/reference/functions/do_action/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to an action hook.

  |

| Used by | Description | 
| [WP_REST_Widget_Types_Controller::render_legacy_widget_preview_iframe()](https://developer.wordpress.org/reference/classes/wp_rest_widget_types_controller/render_legacy_widget_preview_iframe/)`wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php` |

Renders a page containing a preview of the requested Legacy Widget block.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#changelog)󠁿

| Version | Description | 
| [1.5.1](https://developer.wordpress.org/reference/since/1.5.1/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#comment-content-922)
 2.    [hearvox](http://hearingvoices.com)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/wp_footer/#comment-922)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_footer%2F%23comment-922)
     Vote results for this note: 3[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_footer%2F%23comment-922)
 4.  **Example:**
 5.      ```php
         <body>
         	<!-- All the document's HTML goes first. -->
         	<!-- Then last, before closing the body tag, add: -->
         	<?php wp_footer(); ?>
         </body>
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_footer%2F%3Freplytocom%3D922%23feedback-editor-922)
 7.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/wp_footer/?output_format=md#comment-content-5892)
 8.    [thejaydip](https://profiles.wordpress.org/iamjaydip/)  [  4 years ago  ](https://developer.wordpress.org/reference/functions/wp_footer/#comment-5892)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_footer%2F%23comment-5892)
     Vote results for this note: 3[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_footer%2F%23comment-5892)
 10. **You can add javascript code to your site’s footer**
 11.     ```php
         function wpdocs_js_code_example() {
         	?>
         	<script type="text/javascript">
         		/* add your js code here */
         	</script>
         	<?php
         }
         add_action( 'wp_footer', 'wpdocs_js_code_example' );
         ```
     
 12.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_footer%2F%3Freplytocom%3D5892%23feedback-editor-5892)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_footer%2F)
before being able to contribute a note or feedback.