Hookable Events

Overview

Hookable events set the action that triggers a hook, and whether the hook triggers before or after the event.

Note:

WP Squared hooks are an extension of cPanel & WHM hooks. For more information, read cPanel & WHM’s Guide to Standardized Hooks.

Within any WP Squared event (for example, an API call or binary process), the code contains the following phases:

  1. Preparation — The preparation of variables and the environment.
  2. Execution — The execution of specific operations.
  3. 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:

  1. category — The event’s logical grouping within WP Squared.
  2. event — The event that WP Squared performs.
  3. 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

ReturnTypeDescriptionPossible valuesExample
domainstringThe WordPress website to be removed.A valid domain name.example.tld
instance_idintegerThe unique identifier for the domain.A positive integer.42
is_stagingBooleanWhether the website is a staging website.
  • 1 — Enabled.
  • 0 — Disabled.
0

post returns

ReturnTypeDescriptionPossible valuesExample
domainstringThe WordPress website to be removed.A valid domain name.example.tld
instance_idintegerThe unique identifier for the domain.A positive integer.42
is_stagingBooleanWhether the website is a staging website.
  • 1 — Enabled.
  • 0 — Disabled.
0

create_website

This event triggers when a user creates a new website. This includes the initial website linked to the WP Squared account.

Note:

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

ReturnTypeDescriptionPossible valuesExample
domainstringThe WordPress website to be removed.A valid domain name.example.tld
instance_idintegerThe unique identifier for the domain.A positive integer.42
is_stagingBooleanWhether the website is a staging website.
  • 1 — Enabled.
  • 0 — Disabled.
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

ReturnTypeDescriptionPossible valuesExample
domainstringThe WordPress website to be removed.A valid domain name.example.tld
source_instance_idintegerThe unique identifier for the domain to be cloned.A positive integer.42
clone_instance_idintegerThe unique identifier for the cloned domain.A positive integer.66