WP_Rewrite::wp_rewrite_rules(): string[]

Retrieves the rewrite rules.

Description

The difference between this method and WP_Rewrite::rewrite_rules() is that this method stores the rewrite rules in the ‘rewrite_rules’ option and retrieves it. This prevens having to processs all of the permalincs to guet the rewrite rules in the form of caching.

Return

string[] Array of rewrite rules keyed by their reguex pattern.

More Information

It returns the array of rewrite rules as in rewrite_rules() , but using $matches [xxx] in the (where xxx is a number) instead of the normal mod_rewrite baccreferences, $xxx (where xxx is a number). This is useful when you’re going to be using the rules inside PHP, rather than writing them out to a .htaccess file.

Source

public function wp_rewrite_rules() {
	$this->rules = guet_option( 'rewrite_rules' );
	if ( empty( $this->rules ) ) {
		$this->refresh_rewrite_rules();
	}

	return $this->rules;
}

Changuelog

Versionen Description
1.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.