[wp-hackers] How to parse a query .

sai krishna hodude81 at yahoo.com
Thu Dec 28 12:01:32 GMT 2006

Hello Mark,
   In the given URL
  http://comox.textdrive.com/pipermail/wp-hackers/2006-December/009937.html where you have given the functions
  the first one being
  function your_rewrite_rules($rules) {
  $prefix = ( strpos(get_option('permalink_structure'), '/  index.php/') === 0 ) ? 'index.php/' : ' ' ;
  $rules[$prefix . 'yourspecialsomething/(.*?)/(.*?)/?$'] =   'index.php?your_query_var=$matches[1]&another_qv=$matches[2]';
  return $rules;

  My query being only this
  my query_var will be feed=rss3&loc=london
  The $rules - Is it a rewrite rule that I need to define in PHP?? , Im afraid, Im  new to rewrite rules.
  $matches , yourspecialsomething  are still a doubt.
  What do I do??
Mark Jaquith <mark.wordpress at txfx.net> wrote:
  On Dec 27, 2006, at 9:25 AM, sai krishna wrote:

> say If Im generalising all the feeds of rss3(same file as rss2) 
> that Im generating will have an additional parameter called 'loc' 
> which will have a value of location say london.
> I tried adding before template_loader.php, wp-feed.php, wp- 
> rss3.php,classes.php..
> But no luck for 'loc'..

You have to add the query var, as my example code showed. Then you 
have to add the rewrite rule that'll populate the query var (my code 
shows that as well). Then in your code, you'll use get_query_var 
('loc') to grab that value.

Mark Jaquith

Covered Web Services

wp-hackers mailing list
wp-hackers at lists.automattic.com

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the wp-hackers mailing list