88% add-code-to-head

Code Review | Add Code To Head

WordPress plugin Add Code To Head scored 88% from 54 tests.

About plugin

  • Plugin page: add-code-to-head
  • Plugin version: 1.15
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3.2-5.7.2
  • WordPress version: 5.9.2
  • First release: Sep 23, 2012
  • Latest release: Jun 12, 2021
  • Number of updates: 44
  • Update frequency: every 75.6 days
  • Top authors: salubrio (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

5,000+ active / 26,270 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▼0.02MB] [CPU: ▼311.47ms] Passed 4 tests

This is a short check of server-side resources used by Add Code To Head
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▼0.0452.26 ▼0.76
Dashboard /wp-admin3.42 ▲0.0235.81 ▲1.36
Posts /wp-admin/edit.php3.65 ▲0.0138.67 ▼41.98
Add New Post /wp-admin/post-new.php6.89 ▼0.0896.02 ▼1,204.48
Media Library /wp-admin/upload.php3.31 ▲0.0125.31 ▲1.46
Add Code to Head /wp-admin/options-general.php?page=acth_plugin3.2522.65

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 6 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Add Code To Head
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,786 ▲3215.16 ▼0.898.00 ▲1.593.03 ▲0.08
Dashboard /wp-admin2,883 ▲256.11 ▼0.07117.47 ▼17.40160.07 ▼8.23
Posts /wp-admin/edit.php2,696 ▲113.23 ▲0.0065.27 ▼1.59140.80 ▼6.85
Add New Post /wp-admin/post-new.php1,638 ▼2319.26 ▲2.99444.43 ▼3.44148.36 ▼7.02
Media Library /wp-admin/upload.php1,703 ▲25.51 ▼0.03147.21 ▼0.89192.05 ▲4.29
Add Code to Head /wp-admin/options-general.php?page=acth_plugin1,0012.3957.48116.16

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstaller ran successfully

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=acth_plugin
    • > Notice in wp-content/plugins/add-code-to-head/add-code-to-head.php+88
    Trying to access array offset on value of type bool

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/add-code-to-head/uninstall.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/add-code-to-head/add-code-to-head.php:35

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Screenshots: Please add an image for screenshot #1 (Options screen)
Please take inspiration from this readme.txt

add-code-to-head/add-code-to-head.php Passed 13 tests

The primary PHP file in "Add Code To Head" version 1.15 is used by WordPress to initiate all plugin functionality
72 characters long description:
Adds custom html code (javascript, css, etc.) to each public page's head

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin151 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP2146187
Markdown140064

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity2.00
▷ Minimum class complexity2.00
▷ Maximum class complexity2.00
Average method complexity1.12
▷ Minimum method complexity1.00
▷ Maximum method complexity2.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods8
▷ Static methods00.00%
▷ Public methods8100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png28.49KB16.09KB▼ 43.53%