WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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 have a site that must be deployed in a WP Multisite environment but none of the code in the site uses WordPress at all. How can I intercept WordPress, perhaps at 'init', and tell it to stop doing anything and let me take over?

I tried just putting everything in my index.php file and include everything manually from there. However, this results in the <head> of my page being loaded within the body. So it's obvious that I need to interrupt WordPress before it can run wp_head(), but don't know how this might be done.

share|improve this question
up vote 3 down vote accepted

You could hook init and check the current blog ID

function wpa85780_my_app_init(){
    $my_blog_id = 99;
    if( $my_blog_id == get_current_blog_id() ):
        include 'somefile';
add_action( 'init', 'wpa85780_my_app_init' );

This will exit before WordPress does the main query and loads the template.


a slightly earlier action you could hook is after_setup_theme, that seems to be the earliest that get_current_blog_id will work. See the action reference page for the order of actions.

share|improve this answer
Thanks Milo - you were right that after_setup_theme was needed to intercept. – cantera25 Feb 13 '13 at 19:37

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.