I think this comes up in the forum at least once a week, so here’s some handy tips & instructions. First though, some explanations of the terminology.

Hook – what a plugin does when we want it to “hook” into, or run with, whatever wordpress is doing.
Action – does what it says, it acts.
Function – in php, a function is a tiny bit of code that does something, especially if it’s something we want to do often. We write a function, then we call it.

Simply put, this is a two-step process. We add a function as an action, then we hook into WPMU . Kinda like catching a lift.

Are you ready to write a plugin? Hang on, because here we go:


/* We have to start our php with an opening statement.
If we really want to be fancy we can add some things here in the comments to tell everyone what this does. */

Plugin Name: your snazzy new plugin
Description: Adds whatever we want to the footer
Author: your name
Version: 1.0
Author URI: where your plugin can be found, or your website

function your_function_name () { ?>

/* see what we did there? We declared a function then closed our php again. Why? So we can add whatever html goodies we like. */

<p><em>This blog is provided by <a href="<?php get_settings('siteurl'); ?>"><?php get_settings('sitename'); ?></a>.</em></p>

/* Now every blog on our system will get this sentence inserted into the footer of whatever theme they used. And we did not have to edit every single theme. I know you picked something like 250 right? */

<?php }

/* We opened up our php again. we have to tell WPMU something important. */
add_action('wp_footer', your_function_name');

/* Ta da! This is the magic line folks. Let's close up shop now. */

Make sure there’s nothing behind that last >, no whitespace, no line break. .Now, before you go too far, there’s one HUGE CAVEAT for this working. Every theme must have  <?php wp_footer(); ?> somewhere in the footer.php file. Preferably right where you want the contents of your new shiny plugin to show up. Most themes have it, so if you try this and it doesn’t show, check the theme’s footer file first.

I bet you’re already thinking of other things you could put here, like your Google analytics code. 😉


  1. Great post, very helpful! The possibilities are truly endless for what can be hooked into the footer.

    I have one question about your post though…what 250 are you referring to in this sentence…”I know you picked something like 250 right?”

  2. But you have to check to see where exactly in the theme that function has been used and how will the template look once you add text or anything else to that function.

    @Dr. Mike Wendell,
    Just open footer.php and look for the function name and then use it in the code, you don’t have remember it by hart.

  3. Indielab – 250 means 250 themes. Imagine trying to edit them all manually. 🙂

    WPGlamour – yep, you’ll have to check and see how it looks too. For some things, like Google Analytics code, you can skip that part as it won’t be rendered on the page.

  4. Quick and neat as always. I would add a couple of lines.. like how/where to add the call to the footer function in themes that are not provided with and the same tutorial for the header.
    I mean the footer is ok but sometimes you would like to add it to the start of the page… like a navigation menu or google ads, and so on.
    I don’t know if there is such a thing in wordpress mu/wordpress themes but it would be nice to find a way to insert .js as well in the section.
    Let’s assume you want some nice js fx in this repeating section, you should be able to add js libraries in the head section.
    For example, a nice thing to add to all the blog network is something similar to what you can see here where on mouse over the “network menu” comes down (scriptaculous is used here but u can use mootools or something else)

  5. This is great provided I want to track hits throughout the whole WPMU, rite? Any way to make google analytics work for individual blog? Tq

  6. Hello,

    Great intro, straight to the point. Thanks, I tink I now understand the “HOOK” feature.

    Now, a very basic question: where do I find the full list of HOOKs??? I’ve digged into wordpress/wordpressmu and google, without success. Is there such a list at all?

    Otherwise, how do you proceed to find the hook name (and feature attached to it) ?


  7. Is it possible to hook into the footer of only certain blogs? i.e. if I want to hook into the footer of only my main blog or only the blogs that the site admin has created, is there a way I can do that?

  8. For the really slow n00b, you omit an important usage instruction.

    Are we creating an actual plugin to be placed in the plugins folder?


    Is this inserted into the existing footer.php file? (I’m guessing yes)

    It is an informative little tutorial though 🙂

  9. Yes, you would be creating a plugin and putting it in either the plugins or mu-plugins folder. In the mu-plugins folder, it would be applied across the site.

  10. Oh brilliant! Thanks for such a clear explanation – I was able to get Google Analytics into my work’s blogs with no worries! I’m now thinking of many other ways to use this!

  11. What a simple solution to a plaguing problem. Thanks!

    The way you have the plugin constructed, the PHP comments fall outside the PHP code, making them appear in HTML. Then again, because they are purely instructional, people would remove them (I think).