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

---

# do_action( ‘wp_footer’ )

## In this article

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

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

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

## 󠀁[More Information](https://developer.wordpress.org/reference/hooks/wp_footer/?output_format=md#more-information)󠁿

The `wp_footer` action is triggered near the  tag of the [user’s template](https://developer.wordpress.org/themes/basics/template-files/)
by the [wp_footer()](https://developer.wordpress.org/reference/functions/wp_footer/)
function. Although this is theme-dependent, it is one of the most essential theme
hooks, so it is fairly widely supported.

This hook provides no parameters. You use this hook by having your function echo
output to the browser, or by having it perform background tasks. Your functions 
shouldn’t return, and shouldn’t take any parameters.

This hook is theme-dependent which means that it is up to the author of each WordPress
theme to include it. It may not be available on all themes, so you should take this
into account when using it.

When included, the default output for this function is the admin panel which will
be shown in the top of the theme. It should be kept in the footer for every theme
because most of the plugin bind their script files or functions to this hook.

This hook is an action which means that it primarily acts as an event trigger, instead
of a content filter. This is a semantic difference, but it will help you to remember
what this hook does

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

    ```php
    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#L3213)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/general-template.php#L3213-L3213)

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

| Used by | Description | 
| [wp_footer()](https://developer.wordpress.org/reference/functions/wp_footer/)`wp-includes/general-template.php` |

Fires the wp_footer action.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/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/hooks/wp_footer/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 5 content](https://developer.wordpress.org/reference/hooks/wp_footer/?output_format=md#comment-content-3006)
 2.    [1naveengiri](https://profiles.wordpress.org/1naveengiri/)  [  7 years ago  ](https://developer.wordpress.org/reference/hooks/wp_footer/#comment-3006)
 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%2Fhooks%2Fwp_footer%2F%23comment-3006)
     Vote results for this note: 4[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%2Fhooks%2Fwp_footer%2F%23comment-3006)
 4.  **Example code: **
 5.      ```php
         function your_function() {
             echo 'This is inserted at the bottom';
         }
         add_action( 'wp_footer', 'your_function' );
         ```
     
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_footer%2F%3Freplytocom%3D3006%23feedback-editor-3006)
 7.   [Skip to note 6 content](https://developer.wordpress.org/reference/hooks/wp_footer/?output_format=md#comment-content-5262)
 8.    [dubleynguyen](https://profiles.wordpress.org/dudleynguyen/)  [  5 years ago  ](https://developer.wordpress.org/reference/hooks/wp_footer/#comment-5262)
 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%2Fhooks%2Fwp_footer%2F%23comment-5262)
     Vote results for this note: 1[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%2Fhooks%2Fwp_footer%2F%23comment-5262)
 10. In version 5.8 of wordpress the action do_action(‘wp_footer’) seems to be called
     after each widget on the new block based Widgets screen. I think add a condition
     in your function to limit this.
 11.     ```php
         <?php
         function wpdocs_your_function() {
         	if ( is_admin() ) {
         		return;
         	}
     
         	echo 'This is inserted at the bottom';
         }
     
         add_action( 'wp_footer', 'wpdocs_your_function' );
         ?>
         ```
     
 12.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_footer%2F%3Freplytocom%3D5262%23feedback-editor-5262)
 13.  [Skip to note 7 content](https://developer.wordpress.org/reference/hooks/wp_footer/?output_format=md#comment-content-4260)
 14.   [Steven Lin](https://profiles.wordpress.org/stevenlinx/)  [  6 years ago  ](https://developer.wordpress.org/reference/hooks/wp_footer/#comment-4260)
 15. [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%2Fhooks%2Fwp_footer%2F%23comment-4260)
     Vote results for this note: 0[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%2Fhooks%2Fwp_footer%2F%23comment-4260)
 16. Example migrated from Codex:
 17. If you want to influence the moment that your hook is executed, you can append
     an integer as 3rd argument to `add_action`:
 18.     ```php
         <?php
         function your_function() {
             echo '<p>This is inserted at the bottom</p>';
         }
         add_action( 'wp_footer', 'your_function', 100 );
         ?>
         ```
     
 19. The higher the number, the lower the priority and as a result your hook will be
     executed further down the page. Enqueued scripts are executed at priority level
     20.
 20.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_footer%2F%3Freplytocom%3D4260%23feedback-editor-4260)
 21.  [Skip to note 8 content](https://developer.wordpress.org/reference/hooks/wp_footer/?output_format=md#comment-content-4261)
 22.   [Steven Lin](https://profiles.wordpress.org/stevenlinx/)  [  6 years ago  ](https://developer.wordpress.org/reference/hooks/wp_footer/#comment-4261)
 23. [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%2Fhooks%2Fwp_footer%2F%23comment-4261)
     Vote results for this note: -6[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%2Fhooks%2Fwp_footer%2F%23comment-4261)
 24. Example migrated from Codex:
 25. To load jQuery you need to use enqueue function. As described enqueue script executed
     at priority level 20.
 26.     ```php
         <?php
         function load_js() {
             wp_enqueue_script('jquery');
         }
         add_action( 'wp_footer', 'load_js');
         ?>
         ```
     
 27.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_footer%2F%3Freplytocom%3D4261%23feedback-editor-4261)

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