Theme Sniffer

Theme SnifferTheme Sniffer Theme Sniffer is a plugin utilizing custom sniffs for PHP_CodeSniffer that statically analyzes your theme and ensures that it adheres to WordPress coding conventions, as well as checking your code against PHP version compatibility. The plugin is available from GitHub. Themes are not required to pass the Theme Sniffer scan without warnings or errors to be included in the theme directory. is a pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party utilizing custom sniffssniff A module for PHP Code Sniffer that analyzes code for a specific problem. Multiple stiffs are combined to create a PHPCS standard. The term is named because it detects code smells, similar to how a dog would "sniff" out food. for PHP_CodeSniffer that statically analyzes your theme and ensures that it adheres to WordPress coding conventions, as well as checking your code against PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. http://php.net/manual/en/intro-whatis.php. version compatibility.

The plugin is available from Github.

Themes are not required to pass the Theme Sniffer scan without warnings or errors to be included in the theme directory.

Usage

-If you download the plugin from GithubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/, make sure that you select the
distribution plugin zip linked from the documentation. Cloning or downloading the zip file that Github provides will not work.

Install the plugin.

Select the Theme Sniffer menu:

An image describing the Theme Sniffer menu item, available below the Settings menu item.

On the plugin page, you will find the following options:

Select theme: A list of installed themes. The active theme is selected by default.

Theme prefixes: Optional.
Add a list of permitted prefixes to check if all functions and global variables are prefixed correctly. Use one or multiple prefixes, separated by comma – e.g. twentyseventeen,twentysixteen,myprefix.

Select Standard:

Options:

  • Hide Warning: Select this option to hide the warnings and only include errors in the report.
  • Raw Output: Select this option if you prefer to use the PHPCSPHP Code Sniffer PHP Code Sniffer, a popular tool for analyzing code quality. The WordPress Coding Standards rely on PHPCS. formatting in the report.
  • Ignore annotations: Select this option to ignore comments that might disable the sniffsniff A module for PHP Code Sniffer that analyzes code for a specific problem. Multiple stiffs are combined to create a PHPCS standard. The term is named because it detects code smells, similar to how a dog would "sniff" out food., for example phpcs:ignore.
  • Check only PHP files. Select this option to prevent any possible memory leaks from sniffing CSSCSS CSS is an acronym for cascading style sheets. This is what controls the design or look and feel of a site. and JS files.
  • Minimum PHP Version: Select between: 5.2  5.3  5.4  5.5  5.6  7.0  7.1  7.2  7.3.

After selecting your options, select GO to start sniffing. If you need to stop the sniff before it has completed, select STOP.

Top ↑

Report

When the report is generated the results are organized file by file with line number, type, and description.

It is important to remember that:

  • Not all errors are required to be fixed by the Theme Review requirements for including a theme in the directory.
  • All warnings need to be manually checked, for example the escaping.
An image describing how the warnings are presented file by file, with the data in tables.
The table contains the line number, the type of error or warning, and a description.

Top ↑

Using the report in a theme review

Avoid copy pasting the report in the TracTrac Trac is the place where contributors create issues for bugs or feature requests much like GitHub.https://core.trac.wordpress.org/. ticket. The report must be manually checked. Do not include a list of errors and warnings only, check them manually first. Only request the author to fix actual errors that you find during the manual check.

Top ↑

Development

For information about how to contribute to the plugin, see https://github.com/WPTT/theme-sniffer#development

For information about how to contribute to the WPThemeReview Coding standards, see https://github.com/WPTT/WPThemeReview/blob/develop/.github/CONTRIBUTING.md

Top ↑

Reporting issues

Please report issues on Github.

Last updated: