WPCloudDeploy Documentation

Action Hook: wpcd_server_wordpress-app_server_created

do_action( "wpcd_server_{$this->get_app_name()}_server_created", $attributes )

Example Hook

add_action( "wpcd_server_wordpress-app_server_created", 'my_function', 10, 1 );
public function my_function( $attributes ) {
     //your code here
}

Discussion

This hook is triggered after a server has been created but before we install our software stack on it.  At this point the only software on the server is the Operating System.

$attributes is an array that contains information about the server.  But this data (and sometimes more) is also present on the server record which can be accessed using the post_id in the array – $attributes[‘post_id’].

If you attempt to connect to the server when this hook fires, there is no guarantee that the server is fully up and running.  So you should include “retry” logic in your code to retry the server connection until the server is up and running.

Reference

Located in:

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

Availability

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

Share: