78% add-code-to-head

Code Review | Add Code To Head

WordPress plugin Add Code To Head scored78%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: 6.3.1
  • 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 /32,809 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
Installer ran successfully

Server metrics [RAM: ▼0.00MB] [CPU: ▼6.32ms] Passed 4 tests

Analyzing server-side resources used by Add Code To Head
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.40 ▼0.0726.36 ▼12.20
Dashboard /wp-admin3.33 ▲0.0248.22 ▲3.88
Posts /wp-admin/edit.php3.38 ▲0.0241.88 ▼7.63
Add New Post /wp-admin/post-new.php5.91 ▲0.0291.73 ▼2.95
Media Library /wp-admin/upload.php3.25 ▲0.0231.61 ▼2.50
Add Code to Head /wp-admin/options-general.php?page=acth_plugin3.1929.36

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

Filesystem and database footprint
This plugin installed successfully
Filesystem: 6 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Add Code To Head
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5814.78 ▲0.381.80 ▲0.1044.65 ▲8.43
Dashboard /wp-admin2,213 ▲284.88 ▼1.00107.46 ▲8.9742.09 ▼1.61
Posts /wp-admin/edit.php2,093 ▲12.01 ▲0.0436.41 ▼4.6333.05 ▼5.78
Add New Post /wp-admin/post-new.php1,545 ▲1218.45 ▼4.92601.57 ▲2.1548.90 ▼9.51
Media Library /wp-admin/upload.php1,395 ▲74.29 ▲0.0999.15 ▼3.9645.76 ▲1.16
Add Code to Head /wp-admin/options-general.php?page=acth_plugin7782.0328.2926.75

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
    • > 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 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > 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 a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • 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

"Add Code To Head" version 1.15's main PHP file describes plugin functionality and also serves as the entry point to any WordPress 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 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
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

Analyzing cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
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%