---
title: "Post-site creation hooks"
date: "2026-04-02T06:55:31+00:00"
summary:
image:
type: "page"
url: "/acquia-cloud-platform/add-ons/multi-experience-operations/post-site-creation-hooks"
id: "6df0ba63-e01f-44d0-9edf-9c9b67b21b2e"
---

Multi-Experience Operations (MEO) includes a post-site-create hook. Use this script to automate setup tasks after you create or duplicate a site.

Purpose of the hook
-------------------

Automate common tasks to avoid manual configuration:

*   **Update configuration**: Set specific Drupal variables or site names.
*   **Manage modules**: Enable required modules or deactivate unnecessary modules.
*   **Clear caches**: Rebuild Drupal or Varnish caches so the site is ready.
*   **Connect services**: Register the new site URL with external monitoring or security tools.

Set up the hook
---------------

Insert the executable command (Bash or PHP) in the following directory in the codebase: `hooks/common/post-site-create/`

After the hook triggers, Cloud Platform passes these four arguments to the script:

*   **site**: Name of the new site.
*   **target\_env**: Environment that hosts the site, such as dev or prod.
*   **db\_name**: Name of the new database.
*   **source\_site**: Name of the template site if you use the Duplicate Site feature.

Best practices
--------------

*   Write idempotent scripts: Ensure that the script runs safely multiple times without errors.
*   Add error handling: Use logic to catch failures so that a script error does not stop the workflow.
*   Use logs: Use echo statements to track progress. You can access these logs in the **Task Log** on Cloud Platform.
*   Prioritize security: Avoid hardcoding passwords. Use environment variables or platform Drush aliases instead.

Monitor hooks
-------------

To monitor the script:

1.  [Sign in to the Cloud Platform user interface](https://cloud.acquia.com/).
2.  Go to **Codebases**.  
    The system displays all available codebases along with the number of sites and environments associated with the codebases.
3.  Click **Overview** and ensure the **Task Log** contains the post-site-create entry.