10% wp-related-items

Code Review | WP Related Posts and Products (WRI)

WordPress plugin WP Related Posts and Products (WRI) scored10%from 54 tests.

About plugin

  • Plugin page: wp-related-items
  • Plugin version: 1.2.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7.1-5.4.1
  • WordPress version: 6.3.1
  • First release: Dec 11, 2013
  • Latest release: May 11, 2020
  • Number of updates: 72
  • Update frequency: every 32.5 days
  • Top authors: WebshopLogic (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

200+ active /18,173 total downloads

Benchmarks

Plugin footprint 57% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
It is recommended to fix the following installer errors
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/wp-related-items/wri.php+70
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲0.26MB] [CPU: ▲0.52ms] Passed 4 tests

Server-side resources used by WP Related Posts and Products (WRI)
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2547.64 ▲0.34
Dashboard /wp-admin3.57 ▲0.2755.29 ▲0.68
Posts /wp-admin/edit.php3.69 ▲0.3355.65 ▲2.16
Add New Post /wp-admin/post-new.php6.15 ▲0.27101.68 ▼1.09
Media Library /wp-admin/upload.php3.50 ▲0.2744.29 ▲6.55
WP Related Items (WRI) /wp-admin/options-general.php?page=wsl-post-relater-products3.4639.31

Server storage [IO: ▲7.64MB] [DB: ▲0.00MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • There were 13 files (15.49KB) illegally modified outside of "wp-content/plugins/wp-related-items/" and "wp-content/uploads/"
    • (new file) wp-content/themes/twentytwentyone/wri_template/template-wri-thumbnails-widget.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/template-wri-after_loop.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/styles-wri-thumbnails_woocommerce.css
    • (new file) wp-content/themes/twentytwentyone/wri_template/template-wri-before_loop.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/template-wri-list.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/template-wri-thumbnails-widget-woocommerce.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/template-wri-thumbnails-woocommerce.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/styles-wri-thumbnails-widget.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/template-wri-list-widget.php
    • (new file) wp-content/themes/twentytwentyone/wri_template/styles-wri-thumbnails.php
    • ...
Filesystem: 292 new files
Database: no new tables, 19 new options
New WordPress options
db_upgraded
wri_reference2related_items__attachment--attachment
wri_reference2related_items__post--page
wri_reference2related_items__post--post
wri_reference2related_items__attachment--post
wri_related_items___attachment
widget_recent-posts
theysaidso_admin_options
wri_reference2related_items__page--page
wri_general_settings
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP Related Posts and Products (WRI)
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,794 ▲3314.28 ▼0.301.72 ▼0.0543.00 ▼1.96
Dashboard /wp-admin2,203 ▲265.59 ▼0.0894.62 ▲6.0138.27 ▼6.63
Posts /wp-admin/edit.php2,105 ▲51.99 ▼0.0238.76 ▲2.6831.21 ▼3.09
Add New Post /wp-admin/post-new.php1,541 ▲1518.69 ▼4.86615.47 ▼100.9972.89 ▲22.21
Media Library /wp-admin/upload.php1,402 ▲24.19 ▲0.0099.63 ▼11.0945.32 ▼3.31
WP Related Items (WRI) /wp-admin/options-general.php?page=wsl-post-relater-products1,0782.1324.9429.13

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • This plugin did not uninstall successfully, leaving 19 options in the database
    • wri_related_items___attachment
    • wri_reference2related_items__attachment--post
    • wri_reference2related_items__post--post
    • widget_theysaidso_widget
    • wri_reference2related_items__attachment--attachment
    • theysaidso_admin_options
    • wri_reference2related_items__page--page
    • wri_reference2related_items__post--attachment
    • widget_recent-comments
    • db_upgraded
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

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

SRP 0% 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× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/wp-related-items/wri_template/styles-wri-thumbnails-widget.php
    • > /wp-content/plugins/wp-related-items/wri_template/styles-wri-thumbnails.php
  • 112× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/wp-related-items/wri_template/template-wri-before_loop.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-related-items/advanced-custom-fields/includes/forms/form-comment.php:34
    • > PHP Fatal error
      Uncaught Error: Call to undefined function have_posts() in wp-content/plugins/wp-related-items/wri_template/template-wri-thumbnails-widget.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_register_store() in wp-content/plugins/wp-related-items/advanced-custom-fields/includes/acf-form-functions.php:4
    • > PHP Warning
      require_once(../ThumbLib.inc.php): failed to open stream: No such file or directory in wp-content/plugins/wp-related-items/phpthumb/examples/save_differentformat.php on line 26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_register_store() in wp-content/plugins/wp-related-items/advanced-custom-fields/includes/acf-field-group-functions.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/wp-related-items/advanced-custom-fields/includes/fields/class-acf-field-number.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-related-items/advanced-custom-fields/includes/admin/views/html-admin-page-upgrade-network.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/wp-related-items/advanced-custom-fields/includes/fields/class-acf-field-url.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/wp-related-items/advanced-custom-fields/includes/fields/class-acf-field-color_picker.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 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
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 17 tag instead of maximum 10
The official readme.txt is a good inspiration

wp-related-items/wri.php 85% from 13 tests

The primary PHP file in "WP Related Posts and Products (WRI)" version 1.2.7 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wp-related-items.php" instead of "wri.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 351 characters long)

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
Good job! No executable or dangerous file extensions detected93,065 lines of code in 232 files:
LanguageFilesBlank linesComment linesLines of code
PO File3423,65638,67250,119
JavaScript126,6806,57222,200
PHP16811,88719,13018,893
CSS14222611,674
JSON100124
SVG118030
Markdown213025

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity14.63
▷ Minimum class complexity1.00
▷ Maximum class complexity103.00
Average method complexity2.92
▷ Minimum method complexity1.00
▷ Maximum method complexity50.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes112
▷ Abstract classes10.89%
▷ Concrete classes11199.11%
▷ Final classes00.00%
Methods796
▷ Static methods70.88%
▷ Public methods77997.86%
▷ Protected methods141.76%
▷ Private methods30.38%
Functions432
▷ Named functions432100.00%
▷ Anonymous functions00.00%
Constants16
▷ Global constants16100.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
10 compressed PNG files occupy 0.07MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
am/assets/images/complete.png0.76KB0.81KB0.00%
advanced-custom-fields/assets/inc/datepicker/images/ui-icons_DDDDDD_256x240.png3.68KB4.17KB0.00%
advanced-custom-fields/assets/images/acf-logo.png3.40KB3.39KB0.23%
advanced-custom-fields/assets/inc/select2/3/select2x2.png0.64KB0.77KB0.00%
am/assets/images/warn.png0.65KB0.68KB0.00%