Support » Plugins » Hacks » WP_Rewrite Adding rules.

  • Hi,

    I am trying to add a rule that catches every request after the other internal WP rules have not matched (e.g. at the bottom of everything).

    The code I am trying is below.

    	add_rewrite_rule('^([^/]*)', '/?page_id=' . $old_id . '&c=$matches[1]', 'bottom');
    	global $wp_rewrite;

    This code runs, but instead of the rewrite rule ending up on the internal rewrite_rules option in the database, it ends up writing a rule to the .htaccess, which of course then breaks all the URLs on the site as it catches everything.

    My understanding from the docs is add_rewrite_rule() adds it to the db rewrites?


  • The topic ‘WP_Rewrite Adding rules.’ is closed to new replies.