Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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';
        exit;
    endif;
}
add_action( 'init', 'wpa85780_my_app_init' );

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

EDIT

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

 
discard

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.