84% current-menu-item-for-custom-post-types

Code Review | Current Menu Item for Custom Post Types

WordPress plugin Current Menu Item for Custom Post Types scored84%from 54 tests.

About plugin

  • Plugin page: current-menu-item...
  • Plugin version: 1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.1
  • WordPress version: 6.3.1
  • First release: Mar 10, 2014
  • Latest release: Oct 26, 2022
  • Number of updates: 51
  • Update frequency: every 61.9 days
  • Top authors: veribo (66.67%)murgroland (35.29%)

Code review

54 tests

User reviews

23 reviews

Install metrics

3,000+ active /18,110 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼3.72ms] Passed 4 tests

A check of server-side resources used by Current Menu Item for Custom Post Types
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0139.30 ▼5.41
Dashboard /wp-admin3.31 ▲0.0146.92 ▼0.31
Posts /wp-admin/edit.php3.36 ▲0.0146.64 ▲0.07
Add New Post /wp-admin/post-new.php5.89 ▲0.0196.12 ▼6.76
Media Library /wp-admin/upload.php3.23 ▲0.0132.15 ▼2.40
Current Menu Item for Post Types /wp-admin/options-general.php?page=current-menu-item-cpt3.2534.11

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 5 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Current Menu Item for Custom Post Types
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.25 ▼1.351.87 ▲0.0144.40 ▲0.84
Dashboard /wp-admin2,210 ▲254.85 ▼1.1698.58 ▼7.3239.79 ▼1.31
Posts /wp-admin/edit.php2,093 ▲42.03 ▲0.0141.03 ▲0.8834.66 ▼1.56
Add New Post /wp-admin/post-new.php1,517 ▼1617.41 ▼5.99592.22 ▼7.4061.17 ▲9.56
Media Library /wp-admin/upload.php1,395 ▲74.15 ▼0.0794.65 ▲1.0740.92 ▼3.77
Current Menu Item for Post Types /wp-admin/options-general.php?page=current-menu-item-cpt8712.0222.0032.51

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

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

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following items
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/current-menu-item-for-custom-post-types/current-menu-item-for-cpt.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/current-menu-item-for-custom-post-types/include/filter.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_types() in wp-content/plugins/current-menu-item-for-custom-post-types/include/view.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
8 plugin tags: single post, menu active, active menu, highlight menu, custom post types menu active...

current-menu-item-for-custom-post-types/current-menu-item-for-cpt.php 92% from 13 tests

The primary PHP file in "Current Menu Item for Custom Post Types" version 1.5 is used by WordPress to initiate all plugin functionality
The following require your attention:
  • Main file name: The principal plugin file should be the same as the plugin slug ("current-menu-item-for-custom-post-types.php" instead of "current-menu-item-for-cpt.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin196 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP3276193
CSS1003

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.60
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
No PNG images were found in this plugin