Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • this is not working as expected, using the above rule giving me only the user-id not writer name, that means for www.myblog.com/writer/001/umesh-awasthi the rule above giving me only 001 and not the writer-name Commented Jan 20, 2012 at 16:44
  • It is working as I said in my answer. If you have the user ID you don't need the username. If you want both then you can add another queryvar (like arg_username) and add it to the rewriterule: add_rewrite_rule('writer/([0-9]+)/([^/]*)','index.php?pagename=writer&args=$matches[1]&arg_username=$matches[2]','top'); (also change it in the other reriterule) Commented Jan 20, 2012 at 16:48
  • 1
    may be doing some wrong due to lack of knowledge but add_rewrite_rule('writer/([0-9]+)/([^/]*)','index.php?pagename=writer&args=$matches[1]','top'); add_rewrite_rule('writer/([0-9]+)/([^/]*)','index.php?pagename=writer&args=$matches[1]&arg_username=$matches[2]','top'); add_rewrite_rule('writer/([0-9]+)/([^/]*)/page/([0-9]+)','index.php?pagename=writer&args=$matches[1]&arg_username=$matches[2]&paged=$matches[3]','top'); rule still not giving me author name. Commented Jan 20, 2012 at 16:57
  • Edited my answer. Commented Jan 20, 2012 at 17:00
  • 2
    My bad, check updated answer (rewriterule for paged had to be on top). Commented Jan 20, 2012 at 17:31