WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In functions.php I am adding a rewrite rule for this url:

And so on...

This is the code I use, can u please give me the rewrite rules to transform my urls into pretty ones?

    add_action( 'init', 'wpa5413_init' ); 
    function wpa5413_init() {     
        // Remember to flush the rules once manually after you added this code!     
            'Please add my rewrite rule',         
            'Please add my rewrite rule',  
            'top' ); 

    add_filter('query_vars', 'wpa3537_query_vars'); 
    function wpa3537_query_vars($query_vars) {     
        $query_vars[] = 'currentpage';     
        return $query_vars;


share|improve this question
up vote 1 down vote accepted

if you are trying to get

then your function should be

add_action('generate_rewrite_rules', 'currentpage_rewrite_rule_222');

function currentpage_rewrite_rule_222($wp_rewrite){
  $newrules = array();
  $new_rules['currentpage/(\d*)$'] = 'index.php?currentpage=$matches[1]';
  $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;

and just keep your query_vars function the way it is.

 add_filter('query_vars', 'wpa3537_query_vars'); 
    function wpa3537_query_vars($query_vars) {     
        $query_vars[] = 'currentpage';     
        return $query_vars;
share|improve this answer
Thank you, I use a plugin to analyze my rewrite, it's active but not working, any ideeas?:( – webmasters Feb 8 '11 at 21:16
By the way, currentpage1, currentpage2 are from a custom pagination script - i pull data from an external table and paginate them on idex.php – webmasters Feb 8 '11 at 21:35
idex.php or index.php? and what do you get from that plugin when analyzing? – Bainternet Feb 8 '11 at 21:55
Patternt is currentpage/(d*)$ and Substitution is currentpage: (d*) . Index.php is the blog normal index and i have blog.mysite.com/index.php?currentpage=1 – webmasters Feb 8 '11 at 22:01
@webmasters: you are not using wordpress, see: blog.mysite.com/index.php - it gives a 404. – hakre Feb 8 '11 at 23:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.