add_rewrite_tag [ WordPress Function ]
| Parameters: |
|
| See: |
|
| Defined at: |
|
Add 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 'init' hook. This is because $query defaults to "$tag=", and for this to work a new query var has to be added.
Source
<?php
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 );
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Rewrite API/add rewrite tag « WordPress Codex
Description. This function can be used to make WordPress aware of custom querystring variables. Generally, it's used in combination with add_rewrite_rule() to ...
codex.wordpress.org - Broken after upgrade add_rewrite_tag / taxonomy - WordPress
Fatal error: Call to a member function add_rewrite_tag() on a non-object in ( editedout by me ).../taxonomy.php on line 289. 2 site's now down till i find a fix ...
wordpress.org - Rewrite API « WordPress Codex
add_rewrite_tag(): Can be used to allow WordPress to recognize custom variables (particularly custom querystring variables). add_rewrite_endpoint(): Add a ...
codex.wordpress.org - Create your own rewrite rules in WordPress - Prodeveloper.org
Oct 15, 2008 ... functions add_rewrite_tag and generate_rewrite_rule ... As you can see first we use add_rewrite_tag function to create tag. This function add ...
www.prodeveloper.org
Kullanýcý Tartýþmalarý [ wordpress.org ]
- siokstoksanoks on "url rewrite"
- elfin on "Fatal error message when upgrading to 3.0"
- mozity on "Fatal error message when upgrading to 3.0"
- James on "Fatal error message when upgrading to 3.0"
- gwenmccauley on "Fatal error message when upgrading to 3.0"
- James on "Upgraded to 3.0, instant Fatal error: Call to a member function add_rewrite_tag"
- man_vs_himself@hotmail.com on "Upgraded to 3.0, instant Fatal error: Call to a member function add_rewrite_tag"