This code adds a function called ‘install_plugins’ to the ‘admin_init’ action hook. This function then requires the ‘plugin-install’ file from the WordPress admin directory, and creates an array of plugins. The code then loops through the array, using the plugins_api function to retrieve information about each plugin. If an error is returned, the script will die. The code then creates a WP_Ajax_Upgrader_Skin and a Plugin_Upgrader, and uses the Plugin_Upgrader to install the plugin using the download_link retrieved from the plugins_api call. The goal of this code is to automate the installation of one or more plugins.
Was this code snippet helpful?
YesNo