get_error_message(); return; } // Pfad des Plugins $plugin_folder = WP_PLUGIN_DIR; // Plugin Upgrader Klassen einbinden require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/plugin.php'; require_once ABSPATH . 'wp-admin/includes/misc.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; require_once ABSPATH . 'wp-admin/includes/class-wp-ajax-upgrader-skin.php'; require_once ABSPATH . 'wp-admin/includes/class-plugin-upgrader.php'; // Plugin upgrader initialisieren $upgrader = new Plugin_Upgrader(new WP_Ajax_Upgrader_Skin()); // Plugin installieren $result = $upgrader->install($tmp_file); // Temp Datei löschen unlink($tmp_file); activate_plugin($slug . '/' . $slug . '.php' ); // Überprüfen, ob die Installation erfolgreich war if (is_wp_error($result)) { echo 'Installations-Fehler: ' . $result->get_error_message(); } else { echo 'Plugin erfolgreich installiert'; } }