My add_action (wp_footer, ‘method’) is not calling?

In my themes functions.php file I have put:

add_action('wp_footer', 'method');

function method()
{
echo "this is being called";
die();
}

My wordpress footer.php file looks like this:

<?php wp_footer(); ?>
</body>
</html>

What could be the reason my add_action hook is not being called?

I can provide additional code or information if needed.

EDIT:

Instead of die() if I echo a script it won’t appear in the pages footer

add_action('wp_footer', 'method');

function method()
{
echo "<script>...</script>";
}

2 s
2

In a WordPress footer hooks are different for back-end(dashboard) and front-end.

In Dashboard use “admin_footer” hook.

In Front-end use “wp_footer” hook.

Leave a Comment