• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Draft / Install a non-wordpress.org Plugin with WP CLI

Install a non-wordpress.org Plugin with WP CLI

Last updated on November 19, 2018 by Sal Ferrarello

The WordPress plugin repository at wordpress.org/plugins is a great resource. I often use WP CLI to install plugins on my WordPress site from there, e.g.

wp plugin install stop-emails --activate

Sometimes I’m dealing with plugins that are not on the official WordPress.org repository but I’d still like to install them with WP CLI. If they are available for download as a zip file from a URL, you can do this.

Iron Code Studio Hello World Plugin

I’ve created a plugin called Iron Code Studio Hello World Plugin (source code below). This plugin is not available on the WordPress.org repository but I’ve zipped a copy of it and make it available at http://static.ironcodestudio.com/fe-hello-world.zip.

<?php
/**
 * Plugin Name: Iron Code Hello World
 * Plugin URI: http://static.ironcodestudio.com/fe-hello-world.zip
 * Description: An example WordPress plugin that displays "Hello World, from Iron Code Studio"
 * Author: Sal Ferrarello
 * Version: 1.1
 * Author URI: https://salferrarello.com
 * Text Domain: fe-hello-world
 */

function fe_hello_world() {
    echo '<div class="notice notice-success"> 
        <p><strong>"Hello World", from Iron Code Studio.</strong></p>
    </div>';
}

add_action( 'admin_notices', 'fe_hello_world' );

WP CLI Install Plugin from Zip File

Because the fe-hello-world plugin is available at http://static.ironcodestudio.com/fe-hello-world.zip, you can install it with WP CLI with the following command.

wp plugin install http://static.ironcodestudio.com/fe-hello-world.zip --activate

Security Warning

Installing a plugin from a URL without first examining the plugin is a huge security vulnerability. I recommend only installing a plugin in this manner if it is coming from a site you control and the URL uses https. Based on this, I’d recommend limiting installing my fe-hello-world plugin above only on development sites.

Further Reading

WP CLI plugin install documentation

Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a senior backend engineer.

Share this post:

Share on TwitterShare on FacebookShare on LinkedInShare on EmailShare on Reddit
Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Solution Tagged With: WordPress, WordPress Plugin, wp-cli

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in