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

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?

share|improve this question
See this answer. It provides exactly what you need. – Tom Feb 17 '12 at 13:00
Where do I edit/add that code? Which file? – Anders Feb 17 '12 at 13:07
This would reside in your theme's functions.php file. – Tom Feb 17 '12 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. – Chip Bennett Feb 17 '12 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 Feb 17 '12 at 14:49

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


share|improve this answer
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 Jun 2 '12 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. – helgatheviking Jun 2 '12 at 19:15

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.