DocumentationGetting StartedBefore submit to WordPress repository

Before submitting your plugin to the WordPress repository

⚠️

Before submitting your plugin to the WordPress repository directory, you should know some important information about code style.

Install Plugin Check (PCP)

The first thing you should do is to install the Plugin Check. You can download the zip file from the releases page. This plugin will check your plugin for errors and warnings before you submit it to the WordPress repository. You will be able to see the errors and warnings in the WordPress admin panel.

Potential known code issues

When you submit your plugin to the WordPress repository, some lines of code could be rejected. This may happen because the WordPress repository provides a set of pre-commit hooks. These are performed during the commit process. These hooks will perform PHP checking. Below you’ll find a list of possible errors in your code:

// will be rejected by WordPress.org
$list = [
  MyNamespace\MyClass::class
];
 
// correct
$list = [
  'MyNamespace\MyClass'
];
// will be rejected by WordPress.org
if( empty( MyInstance::method() ) ) { 
  ... 
}
 
// correct
$result = MyInstance::method();
if( empty( $result ) ) { 
   ... 
}
// will be rejected by WordPress.org
static::class
  
// right
get_called_class();

If you know of any other issues that could be rejected by the WordPress repository, please let us know.

Deploy version

You will have to use the deploy command to create the deploy version of your plugin. See here for more details.

WordPress.org potential issues

When you submit your plugin to the WordPress repository, you may encounter some issues. Here are some common issues:

Tested Up To Value is Out of Date, Invalid, or Missing

The tested up to value in your plugin is not set to the current version of WordPress. This means your plugin will not show up in searches, as we require plugins to be compatible and documented as tested up to the most recent version of WordPress. Please update your readme to show that it is tested up to the most recent stable major version of WordPress. For example if WordPress said that version 99.0.1 was the current release, you would be able to set your value to 99.0 or 99.0.1, as 99.0.1 would be considered a minor release.

The following links will assist you in understanding WordPress’s versioning and the latest version:

You cannot set it beyond the current version, as that will cause your plugin not to be available on searches. Also remember that WordPress has made late changes in releases, so claiming compatibility with an incomplete version is likely to land you in trouble.

readme.txt
=== WP Kirk ===
Contributors: gfazioli
Donate link: https://wpbones.com/
Tags: template, wpbones
Requires at least: 6.2
Tested up to: 6.5
Stable tag: 1.6.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
your-plugin.php
/**
 * Plugin Name: WP Kirk
 * Plugin URI: https://github.com/wpbones/WPKirk
 * Description: WP Bones template WordPress plugin
 * Version: 1.6.0
 * Requires at least: 6.2
 * Requires PHP: 7.4
 * Author: Giovambattista Fazioli
 * Author URI: https://wpbones.com/
 * License: GPLv2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: wp-kirk
 * Domain Path: languages
 *
 */

No GPL-compatible license declared

It is necessary to declare the license of this plugin. You can do this using the fields available both in the plugin readme and in the plugin headers. Remember that all code, data, and images — anything stored in the plugin directory hosted on WordPress.org — must comply with the GPL or a GPL-Compatible license. Included third-party libraries, code, images, or otherwise, must be also compatible

For a specific list of compatible licenses, please read the GPL-Compatible license list on gnu.org.

The license declared on this plugin is either no present or it’s not GPL compatible:

ERROR: License declaration not found on index.php

Please check the header requirements in order to correctly declare the license of the plugin: https://developer.wordpress.org/plugins/plugin-basics/header-requirements/

It is necessary to configure the “License: ” field in the plugin header with a valid, GPL-compliant license name.

readme.txt
=== WP Kirk ===
Contributors: gfazioli
Donate link: https://wpbones.com/
Tags: template, wpbones
Requires at least: 6.2
Tested up to: 6.5
Stable tag: 1.6.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
your-plugin.php
/**
 * Plugin Name: WP Kirk
 * Plugin URI: https://github.com/wpbones/WPKirk
 * Description: WP Bones template WordPress plugin
 * Version: 1.6.0
 * Requires at least: 6.2
 * Requires PHP: 7.4
 * Author: Giovambattista Fazioli
 * Author URI: https://wpbones.com/
 * License: GPLv2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: wp-kirk
 * Domain Path: languages
 *
 */

The main file of the plugin has a name that does not follow the convention.

The main file of this plugin is named index.php

We expect the main plugin file (the file containing the plugin headers) to have the same name as the plugin folder, which is also the same name as the slug / permalink of the plugin. For example, if your plugin slug is ecpt-social-manager we expect your main plugin filename to be ecpt-social-manager.php

Note that using some common names as the filename for the main plugin file can lead to issues in some configurations. Please check out our tips on how to structure files and folders in a plugin.

This is already handled by the Bones framework starting from v1.5.0. The main file of the plugin is named your-plugin.php.

Using composer but could not find composer.json file

We noticed that your plugin is using Composer to handle library dependencies, that’s great as it will help maintaining and updating your plugin in the future while avoiding collisions with other plugins that are using same libraries. The composer.json file describes the dependencies of your project and may contain other metadata as well. It’s a small file that typically can be found in the top-most directory of your plugin. As one of the strengths of open source is the ability to review, observe, and adapt code, we would like to ask you to include that file in your plugin, even if it is only used for development purposes. This will allow others to exercise the open source freedoms from which we all benefit.

Use the --wp option to deploy the plugin with the composer.json file.

$ php bones deploy --wp

No publicly documented resource for your compressed content

In reviewing your plugin, we cannot find a non-compiled version of your javascript and/or css related source code. In order to comply with our guidelines of human-readable code, we require you to include the source code and / or a link to the non-compressed, developer libraries you’ve included in your plugin. If you include a link, this may be in your source code, however we require you to also have it in your readme.

We strongly feel that one of the strengths of open source is the ability to review, observe, and adapt code. By maintaining a public directory of freely available code, we encourage and welcome future developers to engage with WordPress and push it forward. That said, with the advent of larger and larger plugins using more complex libraries, people are making good use of build tools (such as composer or npm) to generate their distributed production code. In order to balance the need to keep plugin sizes smaller while still encouraging open source development, we require plugins to make the source code to any compressed files available to the public in an easy to find location, by documenting it in the readme.

For example, if you’ve made a Gutenberg plugin and used npm and webpack to compress and minify it, you must either include the source code within the published plugin or provide access to a public maintained source that can be reviewed, studied, and yes, forked. We strongly recommend you include directions on the use of any build tools to encourage future developers.

Use the --wp option to deploy the plugin with the composer.json file.

$ php bones deploy --wp