wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



add_rewrite_rule › WordPress Function

Seit2.1.0
Veraltetn/v
add_rewrite_rule ( $regex, $query, $after = 'bottom' )
Parameter: (3)
  • (string) $regex Regular expression to match request against.
    Erforderlich: Ja
  • (string|array) $query The corresponding query vars for this rewrite rule.
    Erforderlich: Ja
  • (string) $after Optional. Priority of the new rule. Accepts 'top' or 'bottom'. Default 'bottom'.
    Erforderlich: Nein
    Standard: 'bottom'
Definiert in:
Codex:
Changelog:
  • 4.4.0

Adds a rewrite rule that transforms a URL structure to a set of query vars.

Any value in the $after parameter that isn't 'bottom' will result in the rule being placed at the top of the rewrite rules.


Quellcode

function add_rewrite_rule( $regex, $query, $after = 'bottom' ) {
	global $wp_rewrite;

	$wp_rewrite->add_rule( $regex, $query, $after );
}