10% related-items

Code Review | Related Items

WordPress plugin Related Items scored10%from 54 tests.

About plugin

  • Plugin page: related-items
  • Plugin version: 1.1.3
  • PHP version: 7.4.16
  • WordPress compatibility: 2.9-3.6
  • WordPress version: 6.3.1
  • First release: Dec 30, 2011
  • Latest release: Sep 5, 2013
  • Number of updates: 16
  • Update frequency: every 38.4 days
  • Top authors: ChrisHurst (87.5%)MyWebsiteAdvisor (18.75%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active /7,702 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The following installer errors require your attention
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/related-items/plugin-loader.php+33
    Undefined index: action

Server metrics [RAM: ▼0.13MB] [CPU: ▼14.42ms] Passed 4 tests

This is a short check of server-side resources used by Related Items
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0239.93 ▲2.10
Dashboard /wp-admin3.24 ▼0.0733.75 ▼10.13
Posts /wp-admin/edit.php3.30 ▼0.0637.92 ▼10.22
Add New Post /wp-admin/post-new.php5.48 ▼0.4070.10 ▼27.46
Media Library /wp-admin/upload.php3.24 ▲0.0127.86 ▼9.86
Related Items /wp-admin/options-general.php?page=related-items/plugin-admin.php3.2130.27

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

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

Browser metrics Passed 4 tests

Related Items: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,810 ▲5313.59 ▲0.414.32 ▼1.6443.56 ▼3.00
Dashboard /wp-admin2,208 ▲205.82 ▲0.99100.05 ▼4.7936.88 ▼0.75
Posts /wp-admin/edit.php2,104 ▲122.23 ▲0.2240.65 ▼2.7634.02 ▼4.67
Add New Post /wp-admin/post-new.php6,255 ▲4,71326.02 ▲7.74940.86 ▲307.0162.83 ▲12.53
Media Library /wp-admin/upload.php1,396 ▲84.25 ▲0.0695.75 ▼4.6740.66 ▼3.30
Related Items /wp-admin/options-general.php?page=related-items/plugin-admin.php1,2664.53118.7339.54

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=related-items/plugin-admin.php
    • > User deprecated in wp-includes/functions.php+5828
    Hook contextual_help is deprecated since version 3.3.0! Use get_current_screen()->add_help_tab(), get_current_screen()->remove_help_tab() instead.
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=related-items/plugin-admin.php
    • > Warning in wp-content/plugins/related-items/plugin-admin.php+326
    in_array() expects parameter 2 to be array, bool given

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/related-items/plugin-loader.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Related_Items' not found in wp-content/plugins/related-items/plugin-admin.php:3

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following browser errors
    • > GET request to /wp-admin/options-general.php?page=related-items/plugin-admin.php
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/related-items/scripts.js?ver=1.1:35:23)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/options-general.php?page=related-items/plugin-admin.php
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: $(...).live is not a function

Optimizations

Plugin configuration 93% 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: These screenshots have no corresponding images in /assets: #1 (Create and Manage Related Items screenshot.), #2 (Choose Which Custom Post Types to Relate.), #3 (Example Output), #4 (Example Output Closeup), #5 (Related Items Manager Closeup)
Please take inspiration from this readme.txt

related-items/plugin-loader.php 92% from 13 tests

The primary PHP file in "Related Items" version 1.1.3 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("related-items.php" instead of "plugin-loader.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin492 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP327174385
CSS122077
JavaScript113330

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity20.50
▷ Minimum class complexity15.00
▷ Maximum class complexity26.00
Average method complexity3.05
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods1894.74%
▷ Protected methods15.26%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/delete.png0.72KB0.77KB0.00%
images/bullet_red.png1.08KB1.09KB0.00%
images/bullet_green.png3.62KB0.95KB▼ 73.80%