Hookable Events
Overview
Hookable events set the action that triggers a hook, and whether the hook triggers before or after the event.
WP Squared hooks are an extension of cPanel & WHM hooks. For more information, read cPanel & WHM’s Guide to Standardized Hooks.
- Preparation — The preparation of variables and the environment.
- Execution — The execution of specific operations.
- Rendering — The rendering of the operation’s results via HTTP content headers and body.
WP Squared events run routines before (pre
) or after (post
) the execution phase.
Most pre
events can signal a failure that skips the execution phase of the event entirely. The rendering phase uses this signal as if the failure occurred natively, before execution.
Hookable event attributes
All hookable events are comprised of three main attributes:
category
— The event’s logical grouping within WP Squared.event
— The event that WP Squared performs.stage
— The location of the trigger that runs the hook action code, relative to the event.
WP Squared functions
remove_website
This event triggers before removing a WordPress website from a user account.
Information
Action code runs as: user
Blocking attribute: Unavailable.
Escalate privileges attribute: N/A
Available stages
pre
- The hook’s action code runs when a user deletes a Wordpress account.post
- The hook’s action code runs after a user deletes a Wordpress account.
pre returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
domain | string | The WordPress website to be removed. | A valid domain name. | example.tld |
instance_id | integer | The unique identifier for the domain. | A positive integer. | 42 |
is_staging | Boolean | Whether the website is a staging website. |
| 0 |
post returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
domain | string | The WordPress website to be removed. | A valid domain name. | example.tld |
instance_id | integer | The unique identifier for the domain. | A positive integer. | 42 |
is_staging | Boolean | Whether the website is a staging website. |
| 0 |
create_website
This event triggers when a user creates a new website. This includes the initial website linked to the WP Squared account.
This event does not occur when a user clones a website.
Information
Action code runs as: user
Blocking attribute: Unavailable.
Escalate privileges attribute: N/A
Available stages
post
- The hook’s action code runs after a user creates a Wordpress website.
post returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
domain | string | The WordPress website to be removed. | A valid domain name. | example.tld |
instance_id | integer | The unique identifier for the domain. | A positive integer. | 42 |
is_staging | Boolean | Whether the website is a staging website. |
| 0 |
clone_website
This even triggers when a user clones a website.
Information
Action code runs as: user
Blocking attribute: Unavailable.
Escalate privileges attribute: N/A
Available stages
post
- The hook’s action code runs after a user clones a Wordpress website.
post returns
Return | Type | Description | Possible values | Example |
---|---|---|---|---|
domain | string | The WordPress website to be removed. | A valid domain name. | example.tld |
source_instance_id | integer | The unique identifier for the domain to be cloned. | A positive integer. | 42 |
clone_instance_id | integer | The unique identifier for the cloned domain. | A positive integer. | 66 |