Answers for "plugin custom code to install another plugin"

0

plugin custom code to install another plugin

// Include required libs for installation
require_once( ABSPATH . 'wp-admin/includes/plugin-install.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' );

// Get Plugin Info
$api = plugins_api( 'plugin_information',
    array(
        'slug' => $plugin,
        'fields' => array(
            'short_description' => false,
            'sections' => false,
            'requires' => false,
            'rating' => false,
            'ratings' => false,
            'downloaded' => false,
            'last_updated' => false,
            'added' => false,
            'tags' => false,
            'compatibility' => false,
            'homepage' => false,
            'donate_link' => false,
        ),
    )
);
$skin     = new WP_Ajax_Upgrader_Skin();
$upgrader = new Plugin_Upgrader( $skin );
$upgrader->install( $api->download_link );
Posted by: Guest on March-11-2021
0

plugin custom code to install another plugin

define( 'WP_ADMIN', TRUE );
define( 'WP_NETWORK_ADMIN', TRUE ); // Need for Multisite
define( 'WP_USER_ADMIN', TRUE );

require_once('../wp-load.php');
require_once( '../wp-admin/includes/admin.php' );
require_once( '../wp-admin/includes/plugin.php' );

activate_plugin( 'PATH_TO_THE_PLUGIN' );
Posted by: Guest on March-11-2021

Code answers related to "plugin custom code to install another plugin"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language