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 plugin which do very simple task...

if ( $_SERVER["REQUEST_URI"] === '/foo' )
   // How to display the content of page of ID = 3, without using wp_redirect()

So the url is staying at /foo, but show the content of page ID = 3

Any idea?

share|improve this question

If /foo doesn't exist as a page, you can map the URI to another page with a rewrite rule:

function wpa_rewrite(){
add_action( 'init', 'wpa_rewrite' );
share|improve this answer
Seems that I need to flush the rewrite rule after adding it? – Yoga Jun 25 '13 at 15:26
@Yoga - yes, see the plugin example on flush_rewrite_rules() to flush on plugin activation. – Milo Jun 25 '13 at 16:04

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.