{"id":37772,"date":"2025-06-17T06:47:04","date_gmt":"2025-06-17T06:47:04","guid":{"rendered":"https:\/\/www.wpstaq.com\/?post_type=knowledgebase&#038;p=37772"},"modified":"2025-06-17T06:47:04","modified_gmt":"2025-06-17T06:47:04","slug":"automate-permalink-structure-with-custom-deployment-script","status":"publish","type":"knowledgebase","link":"https:\/\/www.wpstaq.com\/sg\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/","title":{"rendered":"Automate Permalink Structure with Custom Deployment Script"},"content":{"rendered":"<h1>Automate Permalink Structure with Custom Deployment Script<\/h1>\n<p>Staq allows you to automate WordPress setup tasks during new site creation using the <strong>Staq Custom Deployment<\/strong> feature. One common customization is setting the permalink structure to include a trailing slash (i.e. <code>\/%postname%\/<\/code>) \u2014 ensuring consistency across all your WordPress sites from the start.<\/p>\n<p>This can be easily configured via the <strong>Post Deploy Script<\/strong> option in Global Settings.<\/p>\n<h2>Step-by-Step: Set Permalink Structure Automatically on New Sites<\/h2>\n<p>If you&#8217;re creating multiple WordPress sites and want each one to use a clean permalink format like <code>\/sample-page\/<\/code>, you can automate this using WP-CLI inside Staq\u2019s deployment script tool.<\/p>\n<h3>\ud83e\udded Where to Find the Setting<\/h3>\n<ol>\n<li>Log in to your Staq dashboard.<\/li>\n<li>Navigate to <strong>Global Settings<\/strong> from the left-hand menu.<\/li>\n<li>Click on <strong>Deployment:<\/strong><\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2025\/06\/staq-deployments.png\" alt=\"&quot;Staq\" \/><\/p>\n<h3>\ud83d\udee0\ufe0f Add the Script<\/h3>\n<p>Inside the <strong>Post Deploy Script<\/strong> field, paste the following WP-CLI command:<\/p>\n<pre><code>wp option update permalink_structure '\/%postname%\/';\r\n<\/code><\/pre>\n<p>Make sure it ends with a semicolon (<code>;<\/code>) as required.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2025\/06\/custom-deployment-script.png\" alt=\"Custom Post Deploy Script for Permalink\" width=\"1024\" \/><\/p>\n<p>Click <strong>Save<\/strong> once added.<\/p>\n<h3>\u2705 What Happens Next<\/h3>\n<p>Every time you spin up a <strong>new site on Staq<\/strong>, the platform will run this deployment script automatically. When the WordPress installation finishes, your permalink structure will already be set to <code>\/postname\/<\/code> \u2014 no need to adjust it manually.<\/p>\n<p>You can test it by:<\/p>\n<ol>\n<li>Creating a new site.<\/li>\n<li>Logging into the WordPress dashboard.<\/li>\n<li>Going to <strong>Settings &gt; Permalinks<\/strong> \u2014 it should already be set.<\/li>\n<\/ol>\n<h3>\ud83d\udca1 Why Use This?<\/h3>\n<ul>\n<li>Saves time on post-setup configurations.<\/li>\n<li>Ensures consistency across all client sites.<\/li>\n<li>Helps prevent SEO or trailing-slash redirect issues.<\/li>\n<\/ul>\n<p>If you\u2019re an agency spinning up many new sites, this is one more task automated \u2014 fewer clicks, fewer mistakes, better efficiency.<\/p>\n","protected":false},"featured_media":0,"parent":0,"template":"","class_list":["post-37772","knowledgebase","type-knowledgebase","status-publish","hentry","categories-deployment"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Automate Permalink Structure with Custom Deployment Script - Managed Hosting Platform for WordPress<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automate Permalink Structure with Custom Deployment Script - Managed Hosting Platform for WordPress\" \/>\n<meta property=\"og:description\" content=\"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%\/) \u2014 ensuring consistency across all your WordPress sites from the start. This can be easily&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/\" \/>\n<meta property=\"og:site_name\" content=\"Managed Hosting Platform for WordPress\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/staqhosting\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2025\/06\/staq-deployments.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/\",\"name\":\"Automate Permalink Structure with Custom Deployment Script - Managed Hosting Platform for WordPress\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/staq-deployments.png\",\"datePublished\":\"2025-06-17T06:47:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/#breadcrumb\"},\"inLanguage\":\"en-sg\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-sg\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/staq-deployments.png\",\"contentUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2025\\\/06\\\/staq-deployments.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/automate-permalink-structure-with-custom-deployment-script\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.wpstaq.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automate Permalink Structure with Custom Deployment Script\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"name\":\"Managed Hosting Platform for WordPress\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wpstaq.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-sg\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\",\"name\":\"Staq\",\"alternateName\":\"WPStaq\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-sg\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"contentUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"width\":512,\"height\":512,\"caption\":\"Staq\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/staqhosting\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpstaq\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automate Permalink Structure with Custom Deployment Script - Managed Hosting Platform for WordPress","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/","og_locale":"en_US","og_type":"article","og_title":"Automate Permalink Structure with Custom Deployment Script - Managed Hosting Platform for WordPress","og_description":"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%\/) \u2014 ensuring consistency across all your WordPress sites from the start. This can be easily&hellip;","og_url":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/","og_site_name":"Managed Hosting Platform for WordPress","article_publisher":"https:\/\/www.facebook.com\/staqhosting\/","og_image":[{"url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2025\/06\/staq-deployments.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/","url":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/","name":"Automate Permalink Structure with Custom Deployment Script - Managed Hosting Platform for WordPress","isPartOf":{"@id":"https:\/\/www.wpstaq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/#primaryimage"},"image":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2025\/06\/staq-deployments.png","datePublished":"2025-06-17T06:47:04+00:00","breadcrumb":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/#breadcrumb"},"inLanguage":"en-sg","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/"]}]},{"@type":"ImageObject","inLanguage":"en-sg","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/#primaryimage","url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2025\/06\/staq-deployments.png","contentUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2025\/06\/staq-deployments.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/automate-permalink-structure-with-custom-deployment-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.wpstaq.com\/"},{"@type":"ListItem","position":2,"name":"Automate Permalink Structure with Custom Deployment Script"}]},{"@type":"WebSite","@id":"https:\/\/www.wpstaq.com\/#website","url":"https:\/\/www.wpstaq.com\/","name":"Managed Hosting Platform for WordPress","description":"","publisher":{"@id":"https:\/\/www.wpstaq.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wpstaq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-sg"},{"@type":"Organization","@id":"https:\/\/www.wpstaq.com\/#organization","name":"Staq","alternateName":"WPStaq","url":"https:\/\/www.wpstaq.com\/","logo":{"@type":"ImageObject","inLanguage":"en-sg","@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","contentUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","width":512,"height":512,"caption":"Staq"},"image":{"@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/staqhosting\/","https:\/\/www.linkedin.com\/company\/wpstaq"]}]}},"_links":{"self":[{"href":"https:\/\/www.wpstaq.com\/sg\/wp-json\/wp\/v2\/knowledgebase\/37772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wpstaq.com\/sg\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/www.wpstaq.com\/sg\/wp-json\/wp\/v2\/types\/knowledgebase"}],"wp:attachment":[{"href":"https:\/\/www.wpstaq.com\/sg\/wp-json\/wp\/v2\/media?parent=37772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}