do_action( ‘get_footer’, string|null $name, array $args )

Fires before the footer template file is loaded.


Name of the specific footer file to use. Null for the default footer.
Additional arguments passed to the footer template.

More Information

get_footer is a hook that gets run at the very start of the get_footer() function call. If you pass in the name for a specific footer file, like get_footer( 'new' ), the do_action will pass in the name as a parameter for the hook. This allows you to limit your add_action calls to specific templates if you wish. Actions added to this hook should be added to your functions.php file.

Note: This hook is best to use to set up and execute code that doesn’t get echoed to the browser until later in the page load. Anything you echo will show up before any of the markup is displayed.


do_action( 'get_footer', $name, $args );


5.5.0The $args parameter was added.
2.8.0The $name parameter was added.

User Contributed Notes

  1. Skip to note 2 content

    The following example will display a script conditionally for a different footer. This is just one example of how you may use the hook and will use a secondary template file of footer-new.php

    function themeslug_footer_hook( $name ) {
    	if ( 'new' == $name ) { ?>
    			(function($) {
    				//put all your jQuery goodness in here.
    add_action( 'get_footer', 'themeslug_footer_hook' );

You must log in before being able to contribute a note or feedback.