I have a strange problem. I hope someone can help me.
So, in my new WordPress theme, I want to have iframes with a nice URL like mydomain.com/go/iframe1/
So i registered a new Rewrite Rule with add_rewrite_tag
and add_rewrite_rule
. Okay, works fine so far, I go to my URL and the iframe shows up. But in my Apache-Logs and with Firebug I get 404 Not Found.
The Rewrite Rule looks like this:
add_rewrite_rule(
'^go/(.*)/?',
'wp-content/themes/mytheme/includes/rewrite/go.php',
'top'
);
So I execute the Script go.php.
The go.php includes the wp-blog-header.php
to have access to the WP functions. And here it looks like the problem occurs. If I don't include the wp-blog-header.php
it works just fine.
What makes me wonder is, that I have other Rewrite-Rules with the same inclusion without the 404 problem. So I think, there needs to be a solution. I thought maybe the slug 'go' would be a problem, but also another like 'iframe' produced the same problem.
It would be very nice if someone could help me out here.
Thanks a lot!
For everybody, who runs into the same problems, this did the trick for me:
You should be including wp-load.php, not wp-blog-header.php
Thanks to bungeshea :)