Custom rewrite rules aren't working (1 post)

  1. Rebecca O'Brien
    Posted 5 years ago #

    I had some custom code (which didn't work) then cycled through the Codex examples (which didn't work) and now I'm wondering what I'm doing wrong. The code I originally used worked properly on a different site, but it wasn't translating. In any case, here's what I have now.

    // Remember to flush_rules() when adding rules
    function flushRules(){
    	global $wp_rewrite;
    // Adding a new rule
    function wp_insertMyRewriteRules($rules)
    	$newrules = array();
    	$newrules['(project)/(\d*)$'] = 'index.php?pagename=$matches[1]&id=$matches[2]';
    	return $newrules + $rules;
    // Adding the id var so that WP recognizes it
    function wp_insertMyRewriteQueryVars($vars)
        array_push($vars, 'id');
        return $vars;

    There is no "id" elemt in the wp_query array. I've reset my permalinks, logged in, logged out, refreshed, cleared cache, etc etc. Something's not right. So...Where am I going wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 5 years ago by Rebecca O'Brien
  • This topic is not resolved
  • WordPress version: 3.0.1