July 14, 2020: Deh Gel Post just had submitted a WordPress plugin called “DG Announcer” to WordPress.org. On and after its approval, several incorrect procedures were fixed after WordPress Plugin Review Team (WPRT) provided the author’s mistakes.

Getting Started

To create a correct plugin complied with the WordPress standards, you have to read the guidelines https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/. Once you done reading it, then you can start working on it.

Note that a plugin’s directory needs folder, PHP file, readme.txt, screenshots, PNG and SVG icons, and banners. You will have to that in order to publish a plugin. Read more on the guidelines provided above.

Folder

Plugin’s main directory should be named as it is. For instance, if you want to create a plugin called “Master Peace” then the main folder should be “master-peace”. It will be its slug, the permanent link assigned.

Main php file

I know that we don’t need to explain this thing, however there might a necessary to mention to correct creating a plugin that internationally won’t conflict another plugin. The first section of this file is the details with license at the following:

/**
 * Plugin Name:     Master Peace
 * Plugin URI:     http://master-peace.wordpress.com
 * Description:    An announcement plugin displayed on the top from header of a wordpress website.
 * Version:        1.0
 * Author:         Deh Saaduddin
 * Author          URI: https://dehgel.wordpress.com
 * License:        GPL2 or later
 * License URI:    https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:    dg-announcer

This section is the license statement of the plugin.

**/

Below it is the code which must start running from a namespace or a class to avoid complexity such as preventing your plugin to have duplicate function or class name. For instance, if there is an existing theme or plugin with a class “MasterPeace” then you have to check that class if running. Checking the class before your plugin runs is given below:

<?php

If (!class_exists(‘MasterPeace’) ) { // Check if MasterPeace class is not running in the website.

} // close

? >

Once the code returned true or positive as class not exists, your code will run. However, neither your created plugin or the theme you used won’t run well if code returns negative as class exist. To dodge the complexity if the class exist, you should have different or very unique prefixing of your classes and function names that other plugins don’t have, like:

<?php

If (!class_exists(‘DGP003_MasterPeace’) ) {

Public functions DGP001_enqueue_styles_scripts() {

// code

}

} // close

?>

Readme.txt

This file is very important to be corrected as WPRT recommends to comply the standards. The standard readme file should the same as the following:

=== Master Peace ===
Contributors: dehgel
Donate link: https://dehgel.wordpress.com/
Tags: announcement
Requires at least: 4.7
Tested up to: 5.4
Stable tag: 1.0
Requires PHP: 7.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

== Description ==
Master Peace is a WordPress plugin blah blah blah….

== Frequently Asked Questions ==
= What about switching it off/on without deactivating the plugin? =

Master Peace will setup this feature at version 1.1 so that you can make an announcement whenever you wanted without activating or deactivating the plugin.

= What is this plugin for? =
This program is basically a notification to visitors of your website.

== Screenshots ==
This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is stored in the /assets directory.

This is the second screen shot

== Changelog ==
= 1.0 =
* Color picker fixed.
* Added paddings input.

== Upgrade Notice ==
= 1.1=
Fixed code issues such as adding a class and prefixes to functions.
= 1.0 =
Changed hexadecimal typing of colors onto text boxes to WordPress standard color-picker to hasten color selections.
= 0.5 =
This version fixes a security related bug.  Upgrade immediately.

Note: Between the sides of the double equals “==” in every section is the titles. Subtitles must have single equal “=” in the both sides.

Screenshots, icons and banners

The images should also comply to the standards including the giving of file names. Below are the following standards for this:

Banners

  • banner-772×250.(png|jpg)
  • banner-772×250-rtl.(png|jpg)
  • banner-1544×500.(png|jpg)
  • banner-1544×500-rtl.(png|jpg)

Icons

  • icon-128×128.png
  • icon-256×256.png
  • svg

Screenshots

You can upload one screenshot to the asset folder but it is better to have two since users exploring screenshots of a plugin before installing it.

  • Screenshot-1.(png|jpg)
  • Screenshot-2.(png|jpg)

Once the instructions above accomplished, you can upload your plugin to the WordPress plugin repository (https://wordpress.org/plugins/developers/add/) then wait for their review. Email will be sent to you sooner.

Note that before adding your authored plugin, you still must aware of the guidelines https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/.

Subversion or SVN

A Subversion or SVN hosted account will be provided to developers by the WordPress team upon plugin’s approval. Deh Gel Post recommend to use TortoiseSVN to upload your plugin’s files and images. Read more how to use SVN https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/

Be with mind that the SVN has four directories which are /assets, /branches, /tags, and /trunk. Once you receive SVN hosted account for your approved plugin, the following might give some smooth path:

/assets

Herein this assets directory should have the images such as the icons, screenshots, and banners. This directory should not be in the /trunk directory.

/branches

You don’t have to add something here unless your plugin have branches. Read more here https://developer.wordpress.org/plugins/wordpress-org/how-to-use-subversion/.

/tags

Each of the version of the plugin should be uploaded into this directory. If you changed some codes in your main file or in the other php files should be considered into new version. Structure your version into 3 digits like “1.0.0” (format: Major.Minor.Patch) for future consequences.

/trunk

This directory handles the publishing of your plugin in the WordPress plugin directory. Once you uploaded the php, js and css files into /trunk, your plugin will later be published. Note that making changes into your php files would be considered as new version since you are patching the file.

This is related how DG Announcer plugin approved and published. Part 2 is upcoming next week. Thank you for reading.