WordPress Plugin Development Is Intense

Given How Deep WordPress Plugins Go, Its Basically A Whole App Store

The amount framework and the depth of plugin development make WordPress a natural choice. That’s why I’m shamelessly running on it. But it turns out all the serious business code that helps everyone do everything so easily is actually pretty complicated to work with. You need to understand the hook and action stack, how good plugins structure their code, the release process, the upgrade process, and the various types of store marketing. There is a whole world full of oceans of WordPress. Its crazy intense. Working in Silicon Valley or some other kickass tech startup its really easy to forget the size of these small markets are actually pretty enormous and the tools are not as simple as it may seem.

Where To Start With WordPress Plugin Development?

Create a directory in the /wp-content/plugins directory. Don’t be a rookie, only use lowercase letters, numbers, and dashes. That means don’t use caps, spaces, or weird special characters. Create a PHP file in that directory with the same name. Add some comments to the top:

/*
Plugin Name: Boring Example Plugin
Plugin URI: http://www.boringexampleplugin.com/
Description: This plugin is like eating cardboard.
Version: 0.1
Author: Nowayne Hel
Author URI: http://www.boringplugindeveloper.com/
*/

Make a class, name the class your plugin’s name. Overload the constructor. Instantiate the class after the declaration. Create a public method in the class called admin_menu. In the constructor you’ll hook in to WordPress. WordPress lets you specify functions you want called after their core code runs specific functions. Its like throwing an event but basically they just keep an list of you functions and call them after they do something. Look for add_action() and you’ll see you can get your functions called after plugin activation, plugin deactivation, you can add things to admin menu, etc.

Copy and Paste My Boring Example WordPress Plugin

<?php

/*
Plugin Name: Boring Example Plugin
Plugin URI: http://www.boringexampleplugin.com/
Description: This plugin is like eating cardboard.
Version: 0.1
Author: Nowayne Hel
Author URI: http://www.boringplugindeveloper.com/
*/
class BoringExamplePlugin {

//constructor for wp-plugin object
public function __construct() {

//activate
register_activation_hook(__FILE__, array($this, 'activate_plugin'));

//deactivate, (this will delete db tables, wp-plugin options, etc.) 
register_deactivation_hook(__FILE__, array($this, 'deactivate_plugin')); 

//actions
add_action('init', array($this, 'init'));
add_action('plugins_loaded', array($this, 'plugins_loaded'));

}

//when your plugins gets activated
public function activate_plugin() {}
 
//when you get deactivated :-(
public function deactivate_plugin() {}

//every time WordPress loads & ur active
public function init() {}

//after plugins are loaded
public function plugins_loaded() {}

}

new BoringExamplePlugin();

?>

You could read their docs or you could look at this garbage plugin and other, classier free plugins. Your choice but if you’re a good programmer you’ll probably look at some other free plugins. Sorry for the shitty formatting and honestly who knows if this compiles I wrote it in a freaking WYIWYG editor bruh.