Title: Custom URL parameter
Last modified: August 20, 2016

---

# Custom URL parameter

 *  [marcoslavorato](https://wordpress.org/support/users/marcoslavorato/)
 * (@marcoslavorato)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/custom-url-parameter/)
 * I have Wp blog that need to receive a custom paramter on category page for filter
   the posts like my rule.
 * For example: http;//mysite.com/category/teste?myvar=ABC
 * How can I get the myvar from URL? I tried a lot of examples on the web, but no
   one works for the category page.
 * Thanks!

Viewing 1 replies (of 1 total)

 *  Thread Starter [marcoslavorato](https://wordpress.org/support/users/marcoslavorato/)
 * (@marcoslavorato)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/custom-url-parameter/#post-2218465)
 * Solved with:
 *     ```
       add_filter( 'category_link','append_parameter', 10, 2 );
   
           function append_parameter( $link, $my_parameter ) {
           $my_parameter = $_GET['sort']; //get sort value
           if ( isset($my_parameter) ) {
               $link = add_query_arg( 'sort', $my_parameter, $link );
           }
               return $link;
           }
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Custom URL parameter’ is closed to new replies.

## Tags

 * [query](https://wordpress.org/support/topic-tag/query/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [marcoslavorato](https://wordpress.org/support/users/marcoslavorato/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/custom-url-parameter/#post-2218465)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
