Giter Site home page Giter Site logo

dexit / wp-custom-plugin-manager Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jannis24/wp-custom-plugin-manager

1.0 0.0 0.0 17 KB

A custom handler class to automatically install, activate, deactivate, upgrade and delete plugins

License: GNU General Public License v3.0

PHP 100.00%

wp-custom-plugin-manager's Introduction

WP Custom Plugin Manager

A custom handler class to manage your plugins plugins from within your plugin, theme or any other code.

What you can do with it:

  • Programmatically Install and Uninstall plugins
  • Programmatically Activate and Deactivate plugins
  • Programmatically Upgrade plugins

How it works

To make it work, please make sure you initiate the wp-custom-plugin-updater-skin.php file, as well as the includes folder. Once you loaded the files, you can start using it as followed.

Initiate the handler

//Include the files mentioned above
include( 'wp-custom-plugin-manager.php' );

$plugin_slug =  'wp-webhooks-comments/wp-webhooks-comments.php'; // usually it is the plugin_folder/plugin_file.php
$plugin_download =  'https://downloads.wordpress.org/plugin/wp-webhooks-comments.latest-stable.zip'; //The zip file of your plugin version you want to install
$manager =  new  WP_Custom_Plugin_Updater(); //Init our handler class

Once you initiated everything, you can use the following functions to simply manage your plugin

Install a plugin

$manager->install( $plugin_slug, $plugin_download, array( 'prevent_outputs' => true ) );

Activate a plugin

$manager->activate( $plugin_slug );

Deactivate a plugin

$manager->deactivate( $plugin_slug );

Update a plugin

//Works only for WordPress.org-hosted plugins or plugins who use a plugin update class like Easy Digital Downloads

$manager->update( $plugin_slug, array( 'prevent_outputs'  =>  true ) );

Uninstall (delete) a plugin

$manager->uninstall( $plugin_slug, array( 'force_delete'  =>  true ) ); //Force delete also deletes the plugin in case its active

wp-custom-plugin-manager's People

Contributors

jannis24 avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.