wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
add_rewrite_tag › WordPress Function
Seit2.1.0
Veraltetn/v
› add_rewrite_tag ( $tag, $regex, $query = '' )
Parameter: (3) |
|
Definiert in: |
|
Codex: |
Adds a new rewrite tag (like %postname%).
The$query
parameter is optional. If it is omitted you must ensure that you call
this on, or before, the {@see 'init'} hook. This is because $query
defaults to
$tag=
, and for this to work a new query var has to be added.Ähnliche Funktionen: add_rewrite_rule, add_rewrite_endpoint, remove_rewrite_tag, add_site_meta, iis7_add_rewrite_rule
Quellcode
function add_rewrite_tag( $tag, $regex, $query = '' ) { // Validate the tag's name. if ( strlen( $tag ) < 3 || '%' !== $tag[0] || '%' !== $tag[ strlen( $tag ) - 1 ] ) { return; } global $wp_rewrite, $wp; if ( empty( $query ) ) { $qv = trim( $tag, '%' ); $wp->add_query_var( $qv ); $query = $qv . '='; } $wp_rewrite->add_rewrite_tag( $tag, $regex, $query ); }