diff --git a/includes/core/apps/wordpress-app/class-wordpress-ssh.php b/includes/core/apps/wordpress-app/class-wordpress-ssh.php index 5bf52ad4..93f0b5fd 100644 --- a/includes/core/apps/wordpress-app/class-wordpress-ssh.php +++ b/includes/core/apps/wordpress-app/class-wordpress-ssh.php @@ -113,17 +113,20 @@ public function get_ssh_key_details( $attributes ) { $ssh_private_key_encrypted = wpcd_get_option( 'vpn_' . $attributes['provider'] . '_sshkey' ); // We don't decrypt the private key itself.... } - // Get some other data elements... - $instance = WPCD()->get_provider_api( $attributes['provider'] )->call( 'details', $attributes ); + // Grab the ip address. + if (metadata_exists('post', $post_id, 'wpcd_server_ipv4')) { // we use the ip from the server post if it's available + $ip = get_post_meta($post_id, 'wpcd_server_ipv4', true); + } else { // otherwise we get it from the provider. + $instance = WPCD()->get_provider_api($attributes['provider'])->call('details', $attributes); + + // Make sure the $instance var is valid otherwise return false. + if (is_wp_error($instance) || empty($instance)) { + return false; + } - // Make sure the $instance var is valid otherwise return false. - if ( is_wp_error( $instance ) || empty( $instance ) ) { - return false; + $ip = $instance['ip']; } - // Grab the ip address. - $ip = $instance['ip']; - // At this point we better have some key data! $key = array( 'passwd' => $ssh_private_key_password, // decrypted.