Exciting News! Flipper Code is now WePlugins! Same commitment to excellence, brand new identity.

How to use admin_footer action in WordPress

Sandeep Kumar Mishra
Sandeep Kumar Mishra
March 14, 2023
5 minutes read

Access Premium WordPress Plugins

admin_footer action

Prints scripts or data before the default footer scripts.

To use the admin_footer action, first, you have to register it using add_action. You can write this code into functions.php of your activated theme or in a custom WordPress Plugin.

We at WePlugins always prefer to create a custom WordPress Plugin while using hooks so nothing breaks when you update your WordPress Theme in the future.

In the below live example, we have defined a function execute_on_admin_footer_event which takes 1 parameter and we registered it using add_action. The first parameter admin_footer is the name of the hook, the second parameter execute_on_admin_footer_event is the name of the function that needs to be called, the third parameter is the priority of calling the hook if the same hook is used multiple times, and the last parameter is the number of arguments (if any) to be passed in the registered function.

Sometimes, you have to remove a registered hook, so you can use remove_action to remove the admin_footer action.

Parameters

  • $data: (string) The data to print.

Live Example 1: Insert Custom HTML in Admin Footer

Below is an example of how you can use this hook to insert custom HTML in the admin footer.

    function weplugins_admin_footer_function() {
        echo '<p>' . __( 'This will be inserted at the bottom of the admin page', 'textdomain' ) . '</p>';
    }
    add_action('admin_footer', 'weplugins_admin_footer_function');
    

Live Example 2: Execute Custom Function on Admin Footer

Below is an example of how you can use this hook to execute a custom function.

    function weplugins_execute_on_admin_footer_event($data){
        // You can write code here to be executed when this action occurs in WordPress.
        // Use the parameters received in the function arguments & implement the required additional custom functionality according to your website requirements.
    }
    // add the action
    add_action("admin_footer", "weplugins_execute_on_admin_footer_event", 10, 1);
    

Live Example 3: Remove a Hook Callback

To remove a hook callback, use the example below:

    remove_action("admin_footer", "weplugins_execute_on_admin_footer_event", 10, 1);
    

Please make sure to provide the same callback function name, priority, and number of arguments while removing the hook callback.

Contact Us

If you need any customization or are having trouble using this hook, please contact us and we’d be happy to assist you.

Sandeep Kumar Mishra

Sandeep Kumar Mishra

Sandeep Kumar Mishra writes about WordPress and Artificial Intelligence, offering tips and guides to help you master your website and stay updated with the latest tech trends.

Explore the latest in WordPress

Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.