Recommended Formatting for Plugin Headers

Written by Jean Galea
Written by Jean Galea
As an aid to plugin developers, we will be frequently posting code snippets or tutorials about best practices. Today we will be dealing with the simplest and most essential part of a WordPress plugin, the comments found in the plugin's main PHP file, aka the header.

Partner Sponsors

BionicWP

Full disclosure: If you purchase through a link on our site, we may earn a commission. Learn more.

As an aid to plugin developers, we will be frequently posting code snippets or tutorials about best practices. Today we will be dealing with the simplest and most essential part of a WordPress plugin, the comments found in the plugin’s main PHP file, aka the header. We’ve gone through some of the top plugins and seen how they format their header. The format below is the one which we liked most, following the syntax employed by Alex Mills (Viper007Bond) in his plugins. We recommend that we use it for your plugins too, because it is very neatly laid out.

[php]
<?php /*

**************************************************************************

Plugin Name: WP Google Adsense Dashboard
Plugin URI: http://www.jeangalea.com/wordpress/wwp-google-adsense-dashboard/
Description: Displays graphical reports on your Google Adsense earnings in the WP dashboard.
Version: 1.0
Author: Jean Galea
Author URI: http://www.jeangalea.com/
License: GPLv3

**************************************************************************

Copyright (C) 2012 Jean Galea

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

**************************************************************************/
?>
[/php]

If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.

This article was filed in our archives.
Written by Jean Galea
Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

In this article

Discover More

Share Your Thoughts

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

New discoveries, every week.
Join thousands of designers, developers, and builders that come to WP Mayor to find the best guides, tools, and services for their next website. One email, once a week.
WP Mayor Newsletter

Claim Your Free Website Tip 👇

Leave your name, email and website URL below to receive one actionable improvement tip tailored just for your website within the next 24 hours.

"They identified areas for improvement that we had not previously considered." - Elliot

By providing your information, you'll also be subscribing to our weekly newsletter packed with exclusive content and insights. You can unsubscribe at any time with just one click.

What's missing?