67% custom-related-posts

Code Review | Custom Related Posts

WordPress plugin Custom Related Posts scored 67% from 54 tests.

About plugin

  • Plugin page: custom-related-posts
  • Plugin version: 1.7.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-6.3
  • WordPress version: 6.3.1
  • First release: Aug 7, 2015
  • Latest release: Sep 13, 2023
  • Number of updates: 42
  • Update frequency: every 70.5 days
  • Top authors: BrechtVds (100%)

Code review

54 tests

User reviews

43 reviews

Install metrics

3,000+ active / 51,660 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.38MB] [CPU: ▲0.23ms] Passed 4 tests

This is a short check of server-side resources used by Custom Related Posts
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.88 ▲0.4243.52 ▼4.20
Dashboard /wp-admin3.71 ▲0.4048.60 ▼2.53
Posts /wp-admin/edit.php3.76 ▲0.4050.53 ▲3.07
Add New Post /wp-admin/post-new.php6.22 ▲0.33100.99 ▲4.59
Media Library /wp-admin/upload.php3.63 ▲0.4040.11 ▲6.98
Import XML /wp-admin/admin.php?page=crp_import_xml_manual3.5134.42
Import XML /wp-admin/admin.php?page=crp_import_xml3.5334.57
Custom Related Posts /wp-admin/options-general.php?page=bv_settings_crp3.5433.15

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 136 new files
Database: no new tables, 10 new options
New WordPress options
widget_recent-posts
widget_crp_widget
widget_recent-comments
can_compress_scripts
db_upgraded
theysaidso_admin_options
crp_migrated_to_version
crp_settings
custom-related-posts_version
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Custom Related Posts
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,852 ▲10613.29 ▼1.015.40 ▲3.4043.75 ▼0.06
Dashboard /wp-admin2,217 ▲354.84 ▼0.97116.51 ▼2.8544.14 ▼1.77
Posts /wp-admin/edit.php2,100 ▲142.02 ▲0.0341.19 ▲2.2134.29 ▼0.95
Add New Post /wp-admin/post-new.php6,606 ▲5,08722.36 ▼0.85898.37 ▲272.7038.63 ▼11.74
Media Library /wp-admin/upload.php1,396 ▲114.23 ▲0.02101.86 ▼3.0642.61 ▼4.28
Import XML /wp-admin/admin.php?page=crp_import_xml_manual6591.147.5713.99
Import XML /wp-admin/admin.php?page=crp_import_xml8142.0723.3829.93
Custom Related Posts /wp-admin/options-general.php?page=bv_settings_crp1,21014.59335.9566.55

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 10 options
    • crp_settings
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • crp_migrated_to_version
    • widget_theysaidso_widget
    • widget_crp_widget
    • widget_recent-comments
    • custom-related-posts_version

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=crp_import_xml_manual
    • > Notice in wp-content/plugins/custom-related-posts/addons/import-xml/import-xml.php+34
    Undefined index: crp_import_xml

SRP 0% 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
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/custom-related-posts/static/faq/whats_new.php
    • > /wp-content/plugins/custom-related-posts/static/faq/our_plugins.php
    • > /wp-content/plugins/custom-related-posts/static/faq/support.php
  • 19× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/custom-related-posts/helpers/settings_structure.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/custom-related-posts/helpers/widget.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function update_option() in wp-content/plugins/custom-related-posts/custom-related-posts.php:90
    • > PHP Notice
      Undefined variable: img_dir in wp-content/plugins/custom-related-posts/static/faq/our_plugins.php on line 40
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/custom-related-posts/static/faq/getting_started.php:45
    • > PHP Notice
      Undefined variable: name in wp-content/plugins/custom-related-posts/static/faq/getting_started.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function trailingslashit() in wp-content/plugins/custom-related-posts/vendor/bv-settings/bv-settings.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/custom-related-posts/static/getting_started_notice.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'CRP_Addon' not found in wp-content/plugins/custom-related-posts/addons/import-xml/import-xml.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/custom-related-posts/helpers/migration/1_6_settings.php:3

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
These are user-side errors you should fix
    • > GET request to /wp-admin/options-general.php?page=bv_settings_crp
    • > Console-api (warning) in unknown
    webpack://BVSettings.%5Bname%5D/./node_modules/react-dom/cjs/react-dom.development.js? 11493:14 "Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: Component, InlineSVG"
    • > GET request to /wp-admin/options-general.php?page=bv_settings_crp
    • > Console-api (warning) in unknown
    webpack://BVSettings.%5Bname%5D/./node_modules/react-dom/cjs/react-dom.development.js? 11493:14 "Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-async-component-lifecycle-hooks for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: AutosizeInput, Component, Select, Toggle"

Optimizations

Plugin configuration Passed 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
4 plugin tags: custom post type, widget, manual related posts, related posts

custom-related-posts/custom-related-posts.php Passed 13 tests

The main PHP script in "Custom Related Posts" version 1.7.2 is automatically included on every request by WordPress
54 characters long description:
Manually define related posts for any custom post type

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected10,474 lines of code in 124 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript443,2734,1046,280
PHP424153302,089
CSS488291,576
Sass9940499
SVG240024
XML1006

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity8.79
▷ Minimum class complexity1.00
▷ Maximum class complexity39.00
Average method complexity2.68
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes28
▷ Abstract classes00.00%
▷ Concrete classes28100.00%
▷ Final classes00.00%
Methods131
▷ Static methods64.58%
▷ Public methods12393.89%
▷ Protected methods00.00%
▷ Private methods86.11%
Functions4
▷ Named functions125.00%
▷ Anonymous functions375.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
8 PNG files occupy 0.16MB with 0.13MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/icon_sprite.png16.84KB1.49KB▼ 91.14%
assets/images/icon_16.png15.37KB0.79KB▼ 94.85%
assets/images/icon_20.png15.72KB0.94KB▼ 94.04%
assets/images/icon_128.png21.07KB3.47KB▼ 83.54%
assets/images/logo.png8.34KB4.43KB▼ 46.86%