Title: prevent get_header() execution
Last modified: August 20, 2016

---

# prevent get_header() execution

 *  [loru88](https://wordpress.org/support/users/loru88/)
 * (@loru88)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/prevent-get_header-execution/)
 * Hi
    I’m interested in prevent execution of get_header() only if some conditions
   have happened. There is any filter or action for this purpose? One solution I’ve
   thinked is to wrap the get_header() in another function with the condition control,
   like this (a rapid example)
 *     ```
       function conditional_get_header(){
       if( ..... )
       get_header()
       else return; //doesn't print the header
       }
       ```
   
 * If there was a particular action or filter would be a cleaner and stable solution

Viewing 1 replies (of 1 total)

 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/prevent-get_header-execution/#post-2200054)
 * I don’t think so. If you look at [the code for that function](http://core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/general-template.php),
   I don’t see any way to avoid it loading _something_, though you could have it
   load a truncated, or even empty header file. Your solution is cleaner than loading
   an empty file though.

Viewing 1 replies (of 1 total)

The topic ‘prevent get_header() execution’ is closed to new replies.

## Tags

 * [get_header](https://wordpress.org/support/topic-tag/get_header/)
 * [header](https://wordpress.org/support/topic-tag/header/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/prevent-get_header-execution/#post-2200054)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
