WP_Rewrite::wp_rewrite_rules()publicWP 1.5.0

Retrieves the rewrite rules.

The difference between this method and WP_Rewrite::rewrite_rules() is that this method stores the rewrite rules in the rewrite_rules and retrieves it. This prevents having to process all of the permalinks to get the rewrite rules in the form of caching.

Method of the class: WP_Rewrite{}

No Hooks.


String[]. Array of rewrite rules keyed by their regex pattern.


global $wp_rewrite;


Since 1.5.0 Introduced.

WP_Rewrite::wp_rewrite_rules() code WP 6.4.3

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

	return $this->rules;