[wp-hackers] creating plugin urls which function as a callback?

Martin Fitzpatrick martin.fitzpatrick at gmail.com
Tue Apr 3 13:57:47 GMT 2007


On 03/04/07, Burobjorn <burobjorn at gmail.com> wrote:

> Basically I would like to create new urls for my plugin and have the url
> function as a callback. Any clues on how to achieve this or does this
> does not make any sense?

If you just want to do something when a particular url is requested
you can test for in in the plugin source, e.g.

if($_GET['blah']='blah'){
//return result
die(0);
}

If you request *any* url on your site with ?blah=blah it will now
output the data and nothing else. e.g.
mywordpressinstall.test?blah=blah . The die(0); stops code execution -
since this is going to be loaded before page output it effectively
stops the rest of the page / loop being processed yet you still have
access to wordpress internals.

By combining a mix of the rewrite rules mentioned by another reply you
should be able to pass whatever you want into the query url above and
trigger any number of actions.  I'd be interested to hear how this
works out.

Martin


More information about the wp-hackers mailing list