84% category-posts-in-custom-menu

Code Review | Category Posts in Custom Menu

WordPress plugin Category Posts in Custom Menu scored84%from 54 tests.

About plugin

  • Plugin page: category-posts-in...
  • Plugin version: 2.1.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.23-6.3
  • WordPress version: 6.3.1
  • First release: Nov 8, 2011
  • Latest release: Nov 11, 2023
  • Number of updates: 136
  • Update frequency: every 32.3 days
  • Top authors: anaid (100%)

Code review

54 tests

User reviews

42 reviews

Install metrics

3,000+ active /87,121 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼4.02ms] Passed 4 tests

This is a short check of server-side resources used by Category Posts in Custom Menu
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0342.87 ▲1.43
Dashboard /wp-admin3.33 ▲0.0244.45 ▼4.79
Posts /wp-admin/edit.php3.38 ▲0.0245.24 ▼3.85
Add New Post /wp-admin/post-new.php5.91 ▲0.0287.91 ▼4.91
Media Library /wp-admin/upload.php3.25 ▲0.0231.65 ▼2.51

Server storage [IO: ▲0.08MB] [DB: ▲0.07MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 9 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
widget_recent-comments
db_upgraded
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

Category Posts in Custom Menu: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,815 ▲5314.58 ▲0.201.87 ▼0.1839.77 ▼7.68
Dashboard /wp-admin2,192 ▲215.60 ▼0.0393.59 ▼1.2839.46 ▼5.88
Posts /wp-admin/edit.php2,103 ▲31.95 ▼0.0740.63 ▲0.0736.02 ▼0.99
Add New Post /wp-admin/post-new.php1,526 ▼023.27 ▼0.23675.65 ▲35.9152.92 ▼15.83
Media Library /wp-admin/upload.php1,397 ▲34.22 ▲0.02107.93 ▲7.7544.47 ▼0.98

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/nav-menu.php): failed to open stream: No such file or directory in wp-content/plugins/category-posts-in-custom-menu/category-posts-in-custom-menu.php on line 34
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/category-posts-in-custom-menu/category-posts-in-custom-menu.php on line 34
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/nav-menu.php' (include_path='.:/usr/share/php') in wp-content/plugins/category-posts-in-custom-menu/category-posts-in-custom-menu.php on line 34

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)
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Go to Appearance > Menu to enable/disable and set the options for the replacement of Category / Post Tag links by their posts.), #2 (Go to Appearance > Customize to enable/disable and set the options for the replacement of Category / Post Tag links by their posts. (Requires WordPress 5.4 or higher))
The official readme.txt is a good inspiration

category-posts-in-custom-menu/category-posts-in-custom-menu.php Passed 13 tests

The main PHP file in "Category Posts in Custom Menu" ver. 2.1.2 adds more information about the plugin and also serves as the entry point for this plugin
138 characters long description:
Dynamic menus: List all posts from a category in your menu. Also works for tags, custom taxonomies as well as pages and custom post types.

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
Success! There were no dangerous files found in this plugin718 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP4138182618
JavaScript2253379
CSS13321

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity41.50
▷ Minimum class complexity2.00
▷ Maximum class complexity81.00
Average method complexity4.52
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods22
▷ Static methods14.55%
▷ Public methods2090.91%
▷ Protected methods00.00%
▷ Private methods29.09%
Functions7
▷ Named functions457.14%
▷ Anonymous functions342.86%
Constants4
▷ Global constants00.00%
▷ Class constants4100.00%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png23.79KB10.03KB▼ 57.86%