[wp-hackers] adding custome

Dion Hulse (dd32) wordpress at dd32.id.au
Sun Sep 27 07:57:42 UTC 2009


Best way is to register a new Query Var, And add a rewrite rule which  
links to it.

eg, Your urls would be:
/xyz/ and ?xyz=1

You check on template_redirect that
if ( 1 == get_query_var('xyz') ) {
    //do stuff,
    die();
}

May seem a bit.. quick and nasty reply, but it'll do.
See this example plugin:
http://dd32.id.au/files/wordpress/test-rewrite.php
(Replace all uses of isset($wp_query->query_vars.....) with  
get_query_var() for best coding practices)


--
Dion Hulse
e: contact at dd32.id.au
w: http://dd32.id.au/
m: 04 6621 9112 (+614 6621 9112)
WordPressQI: http://wordpressqi.com/

On Sun, 27 Sep 2009 17:52:32 +1000, S. M. Ibrahim (Lavlu)  
<smibrahim at gmail.com> wrote:

> hi,
>
> in my plugin i want to add a custom url (example: xyz), my plugin will
> render that page. what's the best way to do this ?
>
>
> thanks in advance
>


More information about the wp-hackers mailing list