public function add_rewrite_rule( $path = '', $after = 'top' ) {
		$uri     = '^' . preg_replace( $this->parameter_pattern, $this->value_pattern_replace, $path );
		$url     = 'index.php?';
		$_url    = array();
		$matches = [];

		if ( preg_match_all( $this->parameter_pattern, $path, $matches ) ) {
			foreach ( $matches[1] as $id => $param ) {
				$param  = ( empty( $this->rewrite_prefix ) ) ? $param : $this->rewrite_prefix . '_' . $param;
				$_url[] = "{$param}=\$matches[" . ( $id + 1 ) . ']';
				$this->add_tag( '%' . $param . '%', '(.+)' );
			}
		}

		$this->rewrite_rule[] = array(
			'regex'   => $uri . '/?',
			'replace' => $url . '' . implode( '&', $_url ),
			'type'    => $after,
		);
		return $this;
	}
public function add_rewrite_rule( $path = '', $after = 'top' ) {
		$uri     = '^' . preg_replace( $this->parameter_pattern, $this->value_pattern_replace, $path );
		$url     = 'index.php?';
		$_url    = array();
		$matches = [];

		if ( preg_match_all( $this->parameter_pattern, $path, $matches ) ) {
			foreach ( $matches[1] as $id => $param ) {
				$param  = ( empty( $this->rewrite_prefix ) ) ? $param : $this->rewrite_prefix . '_' . $param;
				$_url[] = "{$param}=\$matches[" . ( $id + 1 ) . ']';
				$this->add_tag( '%' . $param . '%', '(.+)' );
			}
		}

		$this->rewrite_rule[] = array(
			'regex'   => $uri . '/?',
			'replace' => $url . '' . implode( '&', $_url ),
			'type'    => $after,
		);
		return $this;
	}
public function add_rewrite_rule ( $ path = '' , $ after = 'top' ) { $ uri = '^' . preg_replace ( $ this -> parameter_pattern , $ this -> value_pattern_replace , $ path ) ; $ url = 'index.php?' ; $ _url = array ( ) ; $ matches = [ ] ; if ( preg_match_all ( $ this -> parameter_pattern , $ path , $ matches ) ) { foreach ( $ matches [ 1 ] as $ id => $ param ) { $ param = ( empty ( $ this -> rewrite_prefix ) ) ? $ param : $ this -> rewrite_prefix . '_' . $ param ; $ _url [ ] = "{$param}=\$matches[" . ( $ id + 1 ) . ']' ; $ this -> add_tag ( '%' . $ param . '%' , '(.+)' ) ; } } $ this -> rewrite_rule [ ] = array ( 'regex' => $ uri . '/?' , 'replace' => $ url . '' . implode ( '&' , $ _url ) , 'type' => $ after , ) ; return $ this ; }
Adds Custom Rewrite Rules.

@param string $path
@param string $after

@return $this
Adds Custom Rewrite Rules .