Keep a track of what happens in your header and footer

When developing a theme you should execute the wp_head and wp_footer functions in your theme’s header and footer. The functions are hooked with an action that enables other plug-ins to add necessary files and code. But it is always good to know what happens, and how to remove unwanted code.

Actions and filters are stored in a variable called $wp_filter, so I recommend that you take a peek in it. For example, to see which functions that gets executed in your header, simply look in $wp_filter[‘wp_head’].

[10] => Array
[wp_generator] => Array
[function] => wp_generator
[accepted_args] => 1

Here you can easily see why you have all these meta-tags in your header. And if you for some reason don’t want some or any of these, use the function remove_action. Just make sure you remove the actions before the action is executed.


function remove_unwanted_actions(){
remove_action('wp_head', 'wp_generator');
add_action('wp', 'remove_unwanted_actions');

Now I wouldn’t recommend using this to remove default WordPress actions, but if a plug-in adds some unnecessary stylesheets this is a good way to remove them!


Web Developer @ Oakwood Creative -

Tagged with: ,
Posted in Intermediate

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


WordPress Quick Tips is a blog supplying great tips about WordPress.

We hope to create a great knowledge resource for WordPress developers as well as serving a reminder for all the forgetful ones.

The blog is created and run by Vincent of Oakwood Creative

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 121 other followers

%d bloggers like this: