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

May be the question in title is not explaining what exactly I want. So I will explain one logic and then ask what problem I am getting from that.

We are using wordpress. We have 2 categories Option1(Having 64 different values) and Option2(Having 8 different values). We wanted url like ourdomain/Option1/Option2 depending on users location. And data on that url will be specific according to that Option1 and Option2. We dont wanted all this 64*8 actual wordpress pages to be created.

So after searching much on net we had one solution that I implemented one plugin for routing.

IN that code snippet was as follow.

function site_router() {

global $route,$wp_query,$window_title;
if ( $wp_query->is_404 ) 
        $wp_query->is_404 = false;
                /* According to condition  I had written diffent cases like below.
        default :
            include(get_template_directory() . "/home.php" ); 
            $template =locate_template('pagepath/home.php');
                        $window_title = 'dynamically it will come';
                        if ($template) {


add_action( 'wp', 'site_router');

So by this my purpose was fulfilled successfully.

But now problem is that google is saying they are getting back a 404 error. I think obviosly it will give as after it gives the error we are doing all template loading and all stuff.

So Can any body guide me how can I do this before that 404 response is given to google.

share|improve this question
To question is_* conditionals inside $wp_query, just use the objects method, not the resulting property: $wp_query->is_404() instead of $wp_query->is_404. – kaiser Oct 24 '12 at 20:18
up vote 2 down vote accepted

WordPress has a function to send a different status header:

status_header( 200 );

If you send that after WordPress has send its headers and before you print anything you will get a status header 200.

You could also filter 'status_header' and change the value there. See wp-includes/functions.php for details.

share|improve this answer
Thank You So much. Your answer Helped me out! – Dena Oct 24 '12 at 17:01

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.