Rewrite Permalinks in plugin development.
We add a rewrite rule that tells WordPress to interpret /geostate/oregon URLs the same as ?geostate=oregon.
there are two steps:
(1) "flush" the cached rewrite rules using an init filter, to force WordPress to recalculate the rewrite rules,
add_action('init', 'geotags_flush_rewrite_rules');
function geotags_flush_rewrite_rules()
{
global $wp_rewrite;
$wp_rewrite->flush_rules();
}
(2) use the generate_rewrite_rules action to add a new rule when they are calculated. Here's the "flush" code:
add_action('generate_rewrite_rules', 'geotags_add_rewrite_rules');
function geotags_add_rewrite_rules( $wp_rewrite )
{
$new_rules = array(
'geostate/(.+)' => 'index.php?geostate=' .
$wp_rewrite->preg_index(1) );
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
| -欢迎为本文评级 |
No donations within the last 180 days.Who make donation will leave message at here.Donate Now.
This a wordpress plugin Wp-Donators.It provides a smart donation function to autoleave the sponsor information in this container after payment. People can donate and submit name/URL or TextLink AD. The information of the latest donors are displayed in the cloud. The more a person donates, the bigger their link will be.It's will support most popular payment interface in future. ParPal Just the first one. More..
Powered By:WP-DONATORS
相关日志 |
本文读者也关心以下内容:
|















































Leave a reply