Title: Passing Parameters
Last modified: August 22, 2016

---

# Passing Parameters

 *  [mannyotr](https://wordpress.org/support/users/mannyotr/)
 * (@mannyotr)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/passing-parameters-2/)
 * Right now I have three pages that I am passing parameters into.
 * I am using the code below in my child theme ‘functions.php’ in order to set everything
   up correctly.
 *     ```
       function add_query_vars($aVars) {
         $aVars[] = "profile_status";
         $aVars[] = "raceid";
         $aVars[] = "category";
       return $aVars;
       }
   
       add_filter('query_vars', 'add_query_vars');
   
       function add_rewrite_rules($aRules) {
   
         $aNewRules = array(
                            'racer-profile/([^/]+)/?$'             => 'index.php?pagename=racer-profile&profile_status=$matches[1]'
                           ,'race-registration-page2/([^/]+)/?$'   => 'index.php?pagename=race-registration-page2&raceid=$matches[1]'
                           ,'race-registration-page3/([^/]+)/?$'   => 'index.php?pagename=race-registration-page3&raceid=$matches[1]&category=$matches[2]'
                           );
   
         $aRules = $aNewRules + $aRules;
   
       return $aRules;
       }
   
       add_filter('rewrite_rules_array', 'add_rewrite_rules');
       ```
   
 * Using that code I am able to call one of the pages like this, where ‘8’ is the‘
   raceid’ parameter value:
 * `http://mydomain.com/race-registration-page2/8/`
 * That works just fine.
 * But as you can see in my code, for one of my pages (race-registration-page3) 
   I am trying to pass two parameters (‘raceid’ and ‘category’).
 * When I call that page with just one parameter (‘raceid’) it works perfectly. 
   But as soon as I call it with two parameters (see below), it doesn’t work.
 * `http://mydomain.com/race-registration-page3/8/Solo/`
 * What am I doing wrong?
 * Thanks!

Viewing 1 replies (of 1 total)

 *  Thread Starter [mannyotr](https://wordpress.org/support/users/mannyotr/)
 * (@mannyotr)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/passing-parameters-2/#post-5900178)
 * I figured it out. I needed to fix one small detail…
 *     ```
       'racer-profile/([^/]*)/?'                   => 'index.php?pagename=racer-profile&profile_status=$matches[1]'
       ,'race-registration-page2/([^/]*)/?'         => 'index.php?pagename=race-registration-page2&raceid=$matches[1]'
       ,'race-registration-page3/([^/]*)/([^/]*)/?' => 'index.php?pagename=race-registration-page3&raceid=$matches[1]&category=$matches[2]'
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Passing Parameters’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [mannyotr](https://wordpress.org/support/users/mannyotr/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/passing-parameters-2/#post-5900178)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
