Getting Started

Deployment Deployment - Diagnose Migrations Staging

Site Management

Backups Client Reporting Passwords Plugin Automation Plugin Management - Global Plugins & Themes - Diagnose Plugins & Themes - General Plugins & Themes - Git Plugins & Themes - Logs Must Install White Label WordPress Updates

Caching & Performance

Caching Caching - Blogs/Articles Caching - Diagnose Caching - Git Caching - WooCommerce Redis Optimize & Scale

Security

Security Security - Firewall

SMTP, CDN & DNS

SMTP SendGrid CDN CDN - AWS CDN - Cloudflare CDN - Diagnose Domains & DNS

Server & Tools

Analytics & Logs CRON Jobs Database Debug Tool Git Monitoring PHP Settings Redirects SEO Tools Server Errors sFTP SSL

Staq Billing

Staq Billing > Account Staq Billing > Client Staq Billing > Setup

Media

Media Media - Diagnose Media - Optimize

Accounts & Billing

Accounts & Billing

General

WordPress Hosting Website Diagnose Troubleshoot - Other

Automate Permalink Structure with Custom Deployment Script


On this page

    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

    1. Log in to your Staq dashboard.
    2. Navigate to Global Settings from the left-hand menu.
    3. Click on Deployment:

    "Staq

    🛠️ 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.

    Custom Post Deploy Script for Permalink

    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:

    1. Creating a new site.
    2. Logging into the WordPress dashboard.
    3. 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.