Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the wp_footer hook into the plugin and it doesn't work, but when I copy the code to the "functions.php" file of the active theme it does work, what is the possible problem in this situation ?

    function mixpanel_footer(){

echo '<a style="margin-left:45%;" href=""><img src="//" alt="Mobile Analytics" /></a>';

    add_action( 'wp_footer', 'mixpanel_footer' );
share|improve this question
Please post the code you're using so we can have a better idea of what you're trying to do. –  morganestes Aug 3 '13 at 4:14
are you hooking the code when you put it into functions.php? if not maybe your theme doesn't have wp_footer in the footer.php Without code that's my first guess. –  BandonRandon Aug 3 '13 at 4:40
I updated the question, Yes I'm pretty sure that the theme has wp_footer in footer.php, that's why it's working when I put the code in functions.php –  Waseem Abu Senjer Aug 3 '13 at 9:03

2 Answers 2

Try adding priority to hook as following:

function mixpanel_footer(){

echo '<a style="margin-left:45%;" href=""><img src="//" alt="Mobile Analytics" /></a>';

add_action( 'wp_footer', 'mixpanel_footer', 5 );

For more information on adding priority to wp_footer hook visit this page.

share|improve this answer
I tried it before but it didn't work either. –  Waseem Abu Senjer Aug 3 '13 at 10:30
Is other functionality of plugin working well? –  Vinod Dalvi Aug 3 '13 at 10:40
I have added this code in the plugin file hello.php of Hello Dolly plugin and it worked well. Is there anything wrong in your plugin code? –  Vinod Dalvi Aug 3 '13 at 10:45
@WaseemAbuSenjer - If you view the source of the page, is the HTML being added? It's possible the hook is echoing properly but is hidden due to styles. Also, try adding a priority higher than 5. –  BODA82 Dec 10 '14 at 16:58

Firstly, remove the margin-left CSS property from your html and then try if it works. May be your html is being hidden behind any other html.

Or better try this first -

Remove the current code from your function and just write any non html thing. Then put a die() or exit() and see if it's being rendered properly. Then you can do further debugging.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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