Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

wp plugin install through code

include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..

$plugin = 'plugin-name';

$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,
    ),
));

//includes necessary for Plugin_Upgrader and Plugin_Installer_Skin
include_once( ABSPATH . 'wp-admin/includes/file.php' );
include_once( ABSPATH . 'wp-admin/includes/misc.php' );
include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );

$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
$upgrader->install($api->download_link);
Comment

PREVIOUS NEXT
Code Example
Shell :: wifi falling out 
Shell :: add users in group ubuntu 
Shell :: how to replace a text and delete other text using sed 
Shell :: Shell command, operator and separator/control characters: 
Shell :: How to translate a string to md5 using bash 
Shell :: dump date 
Shell :: setup macbook for development 
Shell :: windows key not raising window in ubuntu 
Shell :: ros 2 binary install 
Shell :: output format is WPS Path to intermediate files is ./ ERROR: edition_num: unable to open GRIBFILE.AAA 
Shell :: kill a server port in terminal 
Shell :: use environment secret variable in helm 
Shell :: xargs echo 
Shell :: chow install cal inlunix 
Shell :: create fake json from terminal 
Shell :: nodemon:%20command%20not%20found 
Shell :: github set commit on head 
Shell :: Error installing a pod - Bus Error at 0x00000001045b8000 
Shell :: msg="could not create cluster: could not create pod disruption budget: poddisruptionbudgets.policy "postgres-fx-postgres-pdb" already exists" 
Shell :: shell -eq 
Shell :: wget health check 
Shell :: commaand creates a copy of the old file with the new name 
Shell :: fix git not showning persian letters 
Shell :: windows how to run sh script 
Shell :: install dlib on windows 
Shell :: Install docker on linux (Ubuntu) 
Shell :: copy commit in another branch 
Shell :: install kubectl on ubuntu 20 
Shell :: sudo: add-apt-repository: command not foun 
Shell :: how compare 2 file size in bash 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =