Ever wondered how to publish a WordPress plugin to WordPress but unsure where to get started? This brief tutorial will help you publish your WordPress plugin to the WordPress.org repository.
File Headers & Readme File
In order for your plugin to be accepted to the Plugin Directory, there are a few things that have to be done first. In the plugin’s main php file, you must have information about your plugin in a comment section. The bare minimum to make WordPress recognize your plugin is to have a `Plugin Name: Name Here` in the main plugin file’s header. Generally, you would want to include other fields as well, such as Author, Author URI, Description, Version, etc. Below is an example of a completed file header for a plugin:
/* Plugin Name: Name Of The Plugin Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates Description: A brief description of the Plugin. Version: The Plugin's Version Number, e.g.: 1.0 Author: Name Of The Plugin Author Author URI: http://URI_Of_The_Plugin_Author License: A "Slug" license name e.g. GPL2 */
In addition to this, to enable your plugin to be listed in the WordPress.org Plugin Directory, you must include a readme.txt file in the root directory of your plugin. The readme file is parsed and used to construct the plugin page on WordPress.org. WordPress provides an example readme.txt file here to reference.
Submitting to WordPress for Review
The next step is to package your plugin into a zip folder, and send a request for WordPress to review your plugin. After zipping your plugin, you will need to upload it to a web server so you can provide the URL to WordPress for review. Once your plugin’s zip is accessible from a public URL, go to the plugin directory and fill out the requested information. Once you submit this form, a reqest will be added for your plugin to be manually reviewed. If all goes well, you will be given access to a subversion repository where you will need to add your plugin files. If there are any issues, you will get an email specifying why your plugin was not accepted; fix the issues and try again.
Adding to Subversion
Once your plugin is approved and you are granted access to a subversion repository for your plugin, you will need to checkout the repository.
`svn co `
** The ‘username’ portion of the above url should be your WordPress.org username. Both your username and password are case sensitive.
This downloads a copy of the subversion repository, which should have the following four folders inside of it: ‘assets’, ‘branches’, ‘tags’, and ‘trunk’.
Copy all of your plugin’s files to the ‘trunk’ directory.
Run the following command from ‘plugin-name’ directory to let subversion know you want to track all the files that are now inside the ‘trunk’ directory.
`svn add trunk/*’
Last, we need to commit to the WordPress.org Plugin Directory. To do this, run the following command.
`svn ci –m “Commit Message Here”`
At this point, you should be prompted for a password to get write access to the repository.
The password is identical to your wordpress.org password.
Thats is all! You should now be set up with WordPress. Let us know if you run into any problems!