I want a custom rewrite rule for my plugin. But for some reason it is not working. I tried flushing url, registered query var. But still it wont work and it gives output like this:


URL without prettifying:


I want to rewrite above url to:


I have added custom query var gallery and gallery_id. Here is my rewrite rule:

    => "index.php?page_id=".$base_page_id."&gallery_id=".$wp_rewrite->preg_index(1),

Please tell me what I am doing wrong. Thanks

  • can you show us the full code in context including where you add the query var? also, you should be using add_rewrite_rule to add a rule. – Milo Apr 29 '14 at 16:05
  • This issue is fixed. actually this rewrite rule is working when I browse to this URL, but this link are not updated to pretty url when I enable permalink. – user1983017 Apr 30 '14 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.