WPCloud Deploy Documentation

Action Hook: wpcd_command_wordpress-app_completed_after_cleanup

do_action( "wpcd_command_{$this->get_app_name()}_completed_after_cleanup", $id, $app_id, $name, $base_command )

This is a variable action hook whose name changes based on the status of the command being run.  See discussion below for more information.

Example Hook

add_action( "wpcd_command_wordpress-app_completed_after_cleanup", 'my_function', 10, 4 );
public function my_function( $id, $app_id, $name, $base_command ) { 
     //your code here 
}

Discussion

This hook is fired after any long-running command is completed and after metas in the associated app records have been removed. Long running commands are actions like deploying servers and websites (the ones that usually include the black ‘terminal’ screen.)

The name of the hook depends on the app name being run.  For WordPress actions, the app name will always be wordpress-app.

Unless you want to run an action after every single long-running command, you should check the $name or $base_command variable and base your code on the result of that check.

If you are looking to perform actions after a WordPress site is deployed, this is likely the hook you need.

  • $id is the post_id of the SERVER custom post type record.
  • $app_id is the post_id of the APP custom post type record.
  • $name is the name of the command being run but it can also include a random number unique to the current process.
  • $base_command is the command name such as change_domain, prepare_server or install_wp.

Reference

Located in:

  • Function: command_completed
  • File: /includes/core/apps/wordpress-app/traits/traits-for-class-wordpres-app/commands-and-logs.php

Other Notes

This hook is used in our SELL WP SITE SUBSCRIPTIONS WITH WOOCOMMERCE add-on to install SSL after a site is deployed.

Availability

This hook is only available in WPCD versions 4.2.5 or later.

 

Share: