Forum Replies Created

Viewing 1 replies (of 1 total)
  • mrpaint

    (@mrpaint)

    I’m using version 2.7.1

    As I look in ./wp-includes/classes.php:145

    $rewrite = $wp_rewrite->wp_rewrite_rules();

    Look in ./wp-includes/rewrite.php:1598

    function wp_rewrite_rules() {
    		$this->rules = get_option('rewrite_rules');
    		if ( empty($this->rules) ) {
    			$this->matches = 'matches';
    			$this->rewrite_rules();
    			update_option('rewrite_rules', $this->rules);
    		}
    
    		return $this->rules;
    	}

    So, they only use the cached rules. If we want to use our rules, we should update the cache. For example, I update in my options page when $_GET[‘updated’] == ‘true’

    PS: I also call add_rewrite_rule in init in case other plugin update cache later ??

    Hope it helps

Viewing 1 replies (of 1 total)