Sample Simple WordPress Plugin

  1. In a file browser — your local operating system one if you’re using WAMP or MAMP, an (S)FTP client if you’re working on a remote server — open up your content directory. It’s usually wp-content.
  2. In wp-content, open the plugins folder.
  3. Create a new folder inside of your plugins folder. Name it something like myplugin.
  4. In that folder, create a file. The convention is to match your folder name with a .php at the end. This isn’t required though. But to fit that example, create a file called myplugin.php.
  5. In that folder, place in the plugin comment header. Modify it to match your desires. (That is, keep the things to the left of the colons (:), but change the things to the right to whatever you want them to be.
  6. Go into your WordPress admin area. On the page Plugins > Installed Plugins, you should now see the plugin you named in step 5. Activate your plugin.
  7. IF YOU WANT TO BREAK YOUR SITE, add a line of PHP to your file, like die('my plugin was here');. If you don’t want to break it, write some valid and non-breaking PHP instead. (That’s a big task, but we have to draw the line somewhere in this tutorial.

Here’s all the code from this tutorial in one block. A final warning: this code is intentionally capable of making your WordPress site break. die is not a joke.

<?php
/*
Plugin Name: WPfastest Addons
Plugin URI: https://wpfastest.com/
Description: For Quick Guides
Version: 1.0.0
Author: WPfastest Addons
Author URI: https://wpfastest.com/
*/

die('my plugin was here');
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Custom Post Types WordPress without Code using Pods

I love Pods for quick building of a single site where I’m not writing much code. It’s a quick way...