EDD\Admin\Installers\PluginSilentUpgrader( new \EDD\Admin\Installers\Install_Skin() ); // Error check. if ( ! method_exists( $installer, 'install' ) ) { wp_send_json_error( $error ); } $installer->install( $post_url ); // phpcs:ignore // Flush the cache and return the newly installed plugin basename. wp_cache_flush(); $plugin_basename = $installer->plugin_info(); if ( $plugin_basename ) { // Activate the plugin silently. $activated = activate_plugin( $plugin_basename, '', false, true ); if ( ! is_wp_error( $activated ) ) { wp_send_json_success( esc_html__( 'Plugin installed & activated.', 'easy-digital-downloads' ) ); } $error = esc_html__( 'Easy Digital Downloads (Pro) was installed, but needs to be activated on the Plugins page inside your WordPress admin.', 'easy-digital-downloads' ); } wp_send_json_error( $error ); } }