In my themes functions.php file I have put:

add_action('wp_footer', 'method');

function method()
echo "this is being called";

My wordpress footer.php file looks like this:

<?php wp_footer(); ?>

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

I can provide additional code or information if needed.


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
    why are you using die()? perhaps that is your problem.
    – KnightHawk
    Jun 15, 2015 at 13:40
  • I want to see if it is being called. If I put echo '<script>..</script>', save it and inspect the page I don't find the script in the footer Jun 15, 2015 at 13:42
  • Pretty sure KnightHawk is right. You are likely killing the application before it generates output.
    – jdm2112
    Jun 15, 2015 at 13:43
  • I apologize. die() was a bad example Jun 15, 2015 at 13:46
  • Are you checking it in Dashboard?? (probably you aren't :) ). If yes, use admin_footer hook for it.
    – Domain
    Jun 15, 2015 at 13:56

2 Answers 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.

  • Argh, this seems so easy and still I failed to remember! Thank you. Can't I upvote 3 or 4 times? :D :D
    – Erenor Paz
    Nov 18, 2016 at 15:00

With such a general function name like method() a collision could be happening. Try something a little more unique than that. Also, if you have access to the server you could also print it to the error log so you don't have to worry when the page is being rendered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.