WP_Rewrite::add_external_rule() WordPress Method

The WP_Rewrite::add_external_rule() method allows you to add an external rewrite rule to the WordPress rewrite system. This is useful if you need to add a custom rewrite rule that is not supported by the WordPress core.

WP_Rewrite::add_external_rule( string $regex, string $query ) #

Adds a rewrite rule that doesn’t correspond to index.php.


Parameters

$regex

(string)(Required)Regular expression to match request against.

$query

(string)(Required)The corresponding query vars for this rewrite rule.


Top ↑

Source

File: wp-includes/class-wp-rewrite.php

	public function add_external_rule( $regex, $query ) {
		$this->non_wp_rules[ $regex ] = $query;
	}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.