WPCloudDeploy Documentation

Filter Hook: wpcd_wordpress-app_initial_server_attributes

apply_filters( "wpcd_{$this->get_app_name()}_initial_server_attributes", $attributes, $args );

Example Hook

add_filter( "wpcd_wordpress-app_initial_server_attributes", 'my_function', 10, 2 );
public function my_function( $attributes, $args ) { 
     //your code here 
}

Discussion

This hook is fired just before data is passed off to the server creation routine. It’s a great place to take any additional fields you’ve added to the server creation popup screen and insert it into the  array of server information that will be stored in the server custom post type record.

  • $attributes is an array of server data that will be used to create the server.  Do not remove anything from this array.  You should only add items to it.  Anything added to it will be stored on the server custom post type record.
  • $args is an array of data that contains all the fields from the server creation popup screen.  If you added any fields to that screen or used your own custom popup screen, you should copy data from this array to the $attributes array in order to get it stored in the server custom post type.  This way you’ll be able to access and use it later.

This filter is for servers created in wp-admin only.  Servers created using WooCommerce on the front-end have a different filter with much different parameters.

Reference

Located in:

  • Function: create_instance
  • File: /includes/core/apps/wordpress-app/class-wordpress-app.php

Availability

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

 

 

Share: