Automate Permalink Structure with Custom Deployment Script
Automate Permalink Structure with Custom Deployment Script
Staq allows you to automate WordPress setup tasks during new site creation using the Staq Custom Deployment feature. One common customization is setting the permalink structure to include a trailing slash (i.e. /%postname%/) — ensuring consistency across all your WordPress sites from the start.
This can be easily configured via the Post Deploy Script option in Global Settings.
Step-by-Step: Set Permalink Structure Automatically on New Sites
If you’re creating multiple WordPress sites and want each one to use a clean permalink format like /sample-page/, you can automate this using WP-CLI inside Staq’s deployment script tool.
🧭 Where to Find the Setting
- Log in to your Staq dashboard.
- Navigate to Global Settings from the left-hand menu.
- Click on Deployment:

🛠️ Add the Script
Inside the Post Deploy Script field, paste the following WP-CLI command:
wp option update permalink_structure '/%postname%/';
Make sure it ends with a semicolon (;) as required.

Click Save once added.
✅ What Happens Next
Every time you spin up a new site on Staq, the platform will run this deployment script automatically. When the WordPress installation finishes, your permalink structure will already be set to /postname/ — no need to adjust it manually.
You can test it by:
- Creating a new site.
- Logging into the WordPress dashboard.
- Going to Settings > Permalinks — it should already be set.
💡 Why Use This?
- Saves time on post-setup configurations.
- Ensures consistency across all client sites.
- Helps prevent SEO or trailing-slash redirect issues.
If you’re an agency spinning up many new sites, this is one more task automated — fewer clicks, fewer mistakes, better efficiency.
Need some help?
We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.