Skip to Content
WordPress® All-in-One For Dummies®
book

WordPress® All-in-One For Dummies®

by Lisa Sabin-Wilson, Cory Miller, Kevin Palmer, Andrea Rennick, Michael Torbert
April 2011
Beginner to intermediate content levelBeginner to intermediate
908 pages
22h 37m
English
For Dummies
Content preview from WordPress® All-in-One For Dummies®

Understanding Plugin Structure

All that is required for WordPress to see a plugin is a PHP file in the wp-content/plugins directory of the site with some special information at the top of the file. This information at the top of a plugin file, typically referred to as a plugins header, is what WordPress looks for when determining which plugins are installed on the site. A freshly installed WordPress site makes a good starting point to understand how this works in practice.

Inspecting WordPress's default plugins

WordPress installs with two plugins by default: Akismet and Hello Dolly. Looking at the files for each of these plugins will help you understand how you can structure your own plugins.

Inside a fresh WordPress site's wp-content/plugins directory, you find a directory named /akismet and two files named hello.php and index.php. The hello.php file is for the Hello Dolly plugin and has the following text at the top of the file.

<?php
/**
 * @package Hello_Dolly
 * @version 1.5.1
 */
/*
Plugin Name: Hello Dolly
Plugin URI: http://wordpress.org/#
Description: This is not just a plugin, it symbolizes the hope and
    enthusiasm of an entire generation summed up in two words sung most
    famously by Louis Armstrong: Hello, Dolly. When activated you will
    randomly see a lyric from <cite>Hello, Dolly</cite> in the upper
    right of your admin screen on every page.
Author: Matt Mullenweg
Version: 1.5.1
Author URI: http://ma.tt/
*/

The section in bold is the plugin header, which tells WordPress ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

WordPress® 24-Hour Trainer

WordPress® 24-Hour Trainer

George Plumley
Gaming Hacks

Gaming Hacks

Simon Carless

Publisher Resources

ISBN: 9780470877012Purchase book