Title: agei's Replies | WordPress.org

---

# agei

  [  ](https://wordpress.org/support/users/agei/)

 *   [Profile](https://wordpress.org/support/users/agei/)
 *   [Topics Started](https://wordpress.org/support/users/agei/topics/)
 *   [Replies Created](https://wordpress.org/support/users/agei/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/agei/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/agei/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/agei/engagements/)
 *   [Favorites](https://wordpress.org/support/users/agei/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [2MB(!!!) rewrite_rules in database. Slow saving pages](https://wordpress.org/support/topic/2mb-rewrite_rules-in-database-slow-saving-pages/)
 *  [agei](https://wordpress.org/support/users/agei/)
 * (@agei)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/2mb-rewrite_rules-in-database-slow-saving-pages/#post-473764)
 * I’ve experienced similar issues with rewrite_rules (WP 2.2) – more to do with
   the database ‘max_allowed_packet’ bytes error when saving the rules to the database,
   but I think it’s the same all round.
 * On examining the actual rules, it appears that up to 6 rules are inserted for
   each static page attachment, which to me appeared excessive (for my needs).
 * So, I looked at the code, and in particular the function page_rewrite_rules (
   c. wp-includes/rewrite.php, Ln 264), and I changed the call to generate-rewrite_rules()
   to set the $feed parameter to false:
 *     ```
       if( is_array( $attachment_uris ) ) {
             foreach ($attachment_uris as $uri => $pagename) {
               $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment=');
               $rewrite_rules = array_merge($rewrite_rules, $this->generate_rewrite_rules($page_structure, EP_PAGES, true, false));
             }
           }
       ```
   
 * This has helped significantly to keep the rewrite rules shorter.
 * Hopefully this can help someone else too.
    /A

Viewing 1 replies (of 1 total)