84% wp-custom-body-class

Code Review | Custom Body Class

WordPress plugin Custom Body Class scored84%from 54 tests.

About plugin

  • Plugin page: wp-custom-body-class
  • Plugin version: 0.7.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2.0-6.0.0
  • WordPress version: 6.3.1
  • First release: Jul 26, 2015
  • Latest release: Jun 10, 2022
  • Number of updates: 21
  • Update frequency: every 119.6 days
  • Top authors: euthelup (80.95%)radu.constantin (23.81%)

Code review

54 tests

User reviews

20 reviews

Install metrics

10,000+ active /84,502 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼9.55ms] Passed 4 tests

This is a short check of server-side resources used by Custom Body Class
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0337.94 ▼0.90
Dashboard /wp-admin3.40 ▲0.0642.55 ▼21.80
Posts /wp-admin/edit.php3.45 ▲0.1043.94 ▼0.70
Add New Post /wp-admin/post-new.php5.94 ▲0.0679.48 ▼14.79
Media Library /wp-admin/upload.php3.26 ▲0.0333.80 ▲0.01
Custom Body Class /wp-admin/options-general.php?page=custom_body_class3.3132.42

Server storage [IO: ▲0.12MB] [DB: ▲0.00MB] Passed 3 tests

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 59 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
custom_body_class_settings
can_compress_scripts

Browser metrics Passed 4 tests

An overview of browser requirements for Custom Body Class
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲4714.44 ▲0.091.67 ▼0.0439.90 ▼5.32
Dashboard /wp-admin2,202 ▲225.56 ▼0.0785.64 ▼3.5038.80 ▼1.87
Posts /wp-admin/edit.php2,104 ▲42.01 ▲0.0539.86 ▲1.8136.85 ▼1.28
Add New Post /wp-admin/post-new.php6,241 ▲4,71518.86 ▼4.12916.80 ▲215.3964.72 ▲7.52
Media Library /wp-admin/upload.php1,407 ▲44.21 ▼0.01106.88 ▼1.2744.98 ▼0.04
Custom Body Class /wp-admin/options-general.php?page=custom_body_class9762.0022.1827.99

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • custom_body_class_settings
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/wp-custom-body-class/core/defaults.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'custom_body_class' not found in wp-content/plugins/wp-custom-body-class/views/admin.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/wp-custom-body-class/settings/general.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
4 plugin tags: class, custom, body, css

wp-custom-body-class/custom_body_class.php 85% from 13 tests

The main PHP script in "Custom Body Class" version 0.7.3 is automatically included on every request by WordPress
You should first fix the following items:
  • Domain Path: The domain path points to a folder that does not exist ("/lang")
  • Main file name: Name the main plugin file the same as the plugin slug ("wp-custom-body-class.php" instead of "custom_body_class.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected1,899 lines of code in 52 files:
LanguageFilesBlank linesComment linesLines of code
PHP464901,0551,447
JavaScript24153299
CSS118892
JSON10031
Markdown17026
SVG1004

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity8.88
▷ Minimum class complexity1.00
▷ Maximum class complexity45.00
Average method complexity2.34
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces7
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods130
▷ Static methods2620.00%
▷ Public methods11386.92%
▷ Protected methods1713.08%
▷ Private methods00.00%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
css/delete.png0.24KB0.22KB▼ 9.20%