php Plugin wordpress

WordPress Basic Plugin

Last updated on November 1st, 2020 at 15:59

Below is a very simple working example of a plugin. Create a directory in your plugins directory, create a php file and copy the below into it.

Then from the wordpress plugins menu simply activate it.

Just know that this plugin does absolutely nothing other than to show the basic setup, including public and protected variables.

	Plugin Name: Plugin Demo
	Plugin URI:
	Description: Just a plugin demo to show how to set up the class
	Author: Gavin Simpson
	Version: 1.0
	Author URI:

class plugindemo
	protected $namespace;
	public $posttype="plugindemo";
	public static function init()
		$class = __CLASS__;
		new $class;
	public function __construct()
	public function test_function($namespace)