I am making a custom wordpress distribution I will use for my own sites including my language and a child theme. But, I want the permalinks to be /%postname%/ by default so that I don't need to change this in the setting after installation.

How can I do this?

  • 1
    See this answer. It provides exactly what you need.
    – Tom
    Commented Feb 17, 2012 at 13:00
  • Where do I edit/add that code? Which file?
    – Anders
    Commented Feb 17, 2012 at 13:07
  • This would reside in your theme's functions.php file.
    – Tom
    Commented Feb 17, 2012 at 13:12
  • "Where do I edit/add that code? Which file?" - If you're making a custom WordPress distribution, you really should already know how to answer this question. That said, I would recommend putting it in a Plugin that you bundle with your custom distribution. Commented Feb 17, 2012 at 14:25
  • also make sure you don't run that code each run since running flush_rules(); is a very big on resources and with that function hooked on init meaning it will run on every page load
    – Bainternet
    Commented Feb 17, 2012 at 14:49

1 Answer 1


i wrote an article recently about how to customize your install (including setting permalinks) with install.php


  • I got an error trying to access your site. Forbidden You don't have permission to access /421/customizing-wordpress-install/ on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
    – Anders
    Commented Jun 2, 2012 at 0:33
  • you too? weird, b/c i have heard that from someone else, but i (and others) can see it just fine. cloudflare must have something against scandinavians. Commented Jun 2, 2012 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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