68% wp-product-selector

Code Review | WP Product Selector

WordPress plugin WP Product Selector scored68%from 54 tests.

About plugin

  • Plugin page: wp-product-selector
  • Plugin version: 1.0.6
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.3.2
  • WordPress version: 6.3.1
  • First release: Feb 10, 2020
  • Latest release: Apr 7, 2020
  • Number of updates: 19
  • Update frequency: every 3.2 days
  • Top authors: wpdevshed (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,636 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼1.63MB] [CPU: ▼49.18ms] Passed 4 tests

This is a short check of server-side resources used by WP Product Selector
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.35 ▼1.118.33 ▼32.48
Dashboard /wp-admin2.37 ▼0.9312.38 ▼36.13
Posts /wp-admin/edit.php2.37 ▼0.9810.56 ▼41.93
Add New Post /wp-admin/post-new.php2.37 ▼3.5111.61 ▼86.18
Media Library /wp-admin/upload.php2.37 ▼0.8613.50 ▼17.11
Selectors /wp-admin/edit-tags.php?taxonomy=selector-category&post_type=ps-questions2.3711.43
Settings /wp-admin/edit.php?post_type=ps-questions&page=product-selector-settings-page2.3711.02
Add New /wp-admin/post-new.php?post_type=ps-questions2.3710.33
Instructions /wp-admin/edit.php?post_type=ps-questions&page=product-selector-instruction-submenu-page2.3711.06
All Questions /wp-admin/edit.php?post_type=ps-questions2.3717.10

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 19 new files
Database: no new tables, 7 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
db_upgraded
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
first_field_option

Browser metrics Passed 4 tests

A check of browser resources used by WP Product Selector
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,995 ▲24914.08 ▼0.506.69 ▲4.8767.71 ▲22.70
Dashboard /wp-admin2,273 ▲855.07 ▲0.19109.14 ▼4.2439.98 ▼3.07
Posts /wp-admin/edit.php2,158 ▲662.33 ▲0.2839.43 ▼9.0933.87 ▼6.97
Add New Post /wp-admin/post-new.php1,580 ▲4418.17 ▼5.17699.08 ▲93.4839.43 ▼15.60
Media Library /wp-admin/upload.php1,455 ▲704.48 ▲0.16103.67 ▲2.1043.88 ▼0.26
Selectors /wp-admin/edit-tags.php?taxonomy=selector-category&post_type=ps-questions1,2952.1432.5328.28
Settings /wp-admin/edit.php?post_type=ps-questions&page=product-selector-settings-page1,1002.3647.5928.20
Add New /wp-admin/post-new.php?post_type=ps-questions1,6392.9662.8633.45
Instructions /wp-admin/edit.php?post_type=ps-questions&page=product-selector-instruction-submenu-page1,4588.18232.0350.38
All Questions /wp-admin/edit.php?post_type=ps-questions1,1362.2534.5830.07

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Uninstall procedure had uncaught errors
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the product-selector-ajax-script handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • Zombie WordPress options detected upon uninstall: 7 options
    • widget_recent-comments
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • first_field_option

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ps-questions
    • > POST request to /wp-admin/admin-ajax.php
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the product-selector-ajax-script handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ps-questions
    • > Notice in wp-content/plugins/wp-product-selector/product-selector.php+223
    Undefined variable: script_params
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=ps-questions
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)

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
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-product-selector/includes/class-product-selector-actions.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-product-selector/includes/class-product-selector-ajax.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-product-selector/includes/class-product-selector-settings-page.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/wp-product-selector/includes/class-product-selector-filters.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
3 plugin tags: marketing, woocommerce, ecommerce

wp-product-selector/product-selector.php 77% from 13 tests

"WP Product Selector" version 1.0.6's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("wp-product-selector.php" instead of "product-selector.php")
  • Requires at least: Required version must match the one declared in readme.txt ("4.0" instead of "4.6")
  • Description: Keep the plugin description shorter than 140 characters (currently 264 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
Everything looks great! No dangerous files found in this plugin1,488 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP8275250838
CSS26522534
JavaScript56253116

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity7.33
▷ Minimum class complexity3.00
▷ Maximum class complexity13.00
Average method complexity1.90
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes133.33%
Methods21
▷ Static methods419.05%
▷ Public methods1885.71%
▷ Protected methods00.00%
▷ Private methods314.29%
Functions24
▷ Named functions24100.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants10100.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
PNG images were not found in this plugin