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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to filter the get_header function on an specific page template to use a custom header located on my plugin folder.

So instead of outputting the theme header, it'd output a custom header from my plugin.

Is this doable?

share|improve this question

get_header() is not filterable. Neither is locate_template().

Themes can alter which header loads by passing a parameter to get_header(). There is no obvious way that I see for plugins to alter which header loads. As I think about it, that makes a lot of sense. It would be fantastically easy for plugins to break themes by altering the header.

You can hook into get_header or wp_head to add things to the header, if that helps. If the "specific page template" is one that the plugin controls then you can write your header into the template.

If you explain why you want to do this a better answer may be possible.

share|improve this answer

Err, Maybe I'm overtired but why don't you just duplicate the page template and hack the get_header()

<?php get_header( 'edhead' ); ?>

Which will call header-edhead.php instead of header.php

Then switch the page template to this template.


share|improve this answer
The OP wants to have the custom header in a plugin's folder, not in the theme folder. Otherwise, yes, your answer is the way to go. – Pat J Aug 26 '13 at 21:15

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.