Title: help out adding rewrite rule
Last modified: August 21, 2016

---

# help out adding rewrite rule

 *  [th90](https://wordpress.org/support/users/th90/)
 * (@th90)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/help-out-adding-rewrite-rule/)
 * Hi.
    I want to test wordpress add rewrite rule function. I added below code to
   my theme’s functions.php in order to rewrite tha category permalinks.
 *     ```
       add_action( 'init', 'add_cat_rules' );
       function add_cat_rules() {
           add_rewrite_rule(
               "/cid=([0-9]+)/?",
               "index.php?cat=$matches[1]",
               "top");
       }
       ```
   
 * but it does not do anything.
    can anyone give me a working example on how to 
   rewrite my permalinks? Thanks a lot.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [th90](https://wordpress.org/support/users/th90/)
 * (@th90)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/help-out-adding-rewrite-rule/#post-4040388)
 * Any help???
 *  [WHUK_Barb](https://wordpress.org/support/users/whuk_barb/)
 * (@whuk_barb)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/help-out-adding-rewrite-rule/#post-4040389)
 * Hi,
 * I’d suggest referring to the following pages :
 * [http://codex.wordpress.org/Class_Reference/WP_Rewrite](http://codex.wordpress.org/Class_Reference/WP_Rewrite)
   
   [http://codex.wordpress.org/Function_Reference/flush_rewrite_rules](http://codex.wordpress.org/Function_Reference/flush_rewrite_rules)
   [http://www.askapache.com/wordpress/remove-category-wordpress-urls.html](http://www.askapache.com/wordpress/remove-category-wordpress-urls.html)
 *  Thread Starter [th90](https://wordpress.org/support/users/th90/)
 * (@th90)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/help-out-adding-rewrite-rule/#post-4040390)
 * Thanks WHUK_Barb;
    I saw wp_rewrite and other functions information on wordpress
   codex. i added a rewrite rule but it does not work. Know just i want a simple
   example for rewriting a default permalink like category permalinks or …

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘help out adding rewrite rule’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [th90](https://wordpress.org/support/users/th90/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/help-out-adding-rewrite-rule/#post-4040390)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
