68% advanced-custom-routes-custom-endpoints-for-wp-rest-api

Code Review | Advanced Custom Routes - Custom Endpoints for WP REST API

WordPress plugin Advanced Custom Routes - Custom Endpoints for WP REST API scored68%from 54 tests.

About plugin

  • Plugin page: advanced-custom-r...
  • Plugin version: 0.8.0
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Jul 27, 2019
  • Latest release: Jul 28, 2019
  • Number of updates: 4
  • Update frequency: every 1.0 days
  • Top authors: lcarlile (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

60+ active /1,837 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.96MB] [CPU: ▼56.24ms] Passed 4 tests

This is a short check of server-side resources used by Advanced Custom Routes - Custom Endpoints for WP REST API
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.03 ▼1.445.13 ▼40.97
Dashboard /wp-admin2.05 ▼1.265.64 ▼46.07
Posts /wp-admin/edit.php2.05 ▼1.318.08 ▼41.77
Add New Post /wp-admin/post-new.php2.05 ▼3.845.94 ▼96.16
Media Library /wp-admin/upload.php2.05 ▼1.186.44 ▼31.20
Settings /wp-admin/edit.php?post_type=cd-custom-rest-api&page=wp-rest-endpoints-settings2.056.64
Custom Routes /wp-admin/edit.php?post_type=cd-custom-rest-api2.055.71

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

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

Browser metrics Passed 4 tests

A check of browser resources used by Advanced Custom Routes - Custom Endpoints for WP REST API
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲7413.19 ▼1.194.65 ▲2.8441.94 ▲0.09
Dashboard /wp-admin2,226 ▲495.84 ▲0.1896.13 ▲5.2851.72 ▲4.69
Posts /wp-admin/edit.php2,137 ▲372.29 ▲0.3339.77 ▲1.3346.78 ▲10.48
Add New Post /wp-admin/post-new.php1,556 ▲2823.53 ▲0.53681.04 ▲68.4265.24 ▲13.32
Media Library /wp-admin/upload.php1,434 ▲314.42 ▲0.22102.07 ▲4.2454.69 ▲10.74
Settings /wp-admin/edit.php?post_type=cd-custom-rest-api&page=wp-rest-endpoints-settings8691.8126.8534.89
Custom Routes /wp-admin/edit.php?post_type=cd-custom-rest-api1,1062.2532.4041.14

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
These items require your attention
  • The plugin did not uninstall gracefully
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style 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 select2_styles handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These server-side errors were triggered
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=cd-custom-rest-api
    • > POST request to /wp-admin/admin-ajax.php
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style 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 select2_styles handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=cd-custom-rest-api
    • > POST request to /wp-admin/admin-ajax.php
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style 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 select2_styles handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=cd-custom-rest-api
    • > POST request to /wp-admin/admin-ajax.php
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_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 select2_scripts handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=cd-custom-rest-api
    • > 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 select2_scripts handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)

SRP 50% 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
The following issues need your attention
  • 26× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/query-builder/query-builder-options/date/date-after.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function maybe_unserialize() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/query-builder/query-builder-options/post-types/post-type.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function maybe_unserialize() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/query-builder/query-builder-options/tags/tag-include.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/route-endpoint/route-endpoint.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/register-custom-post-type.php:48
    • > PHP Fatal error
      Uncaught Error: Call to undefined function maybe_unserialize() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/query-builder/query-builder-options/post-parent/post-parent-include.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function maybe_unserialize() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/query-builder/query-builder-options/categories/category-exclude.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/query-builder/query-builder-options/date/date-before.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function maybe_unserialize() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/query-builder/query-builder-options/status/status.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-custom-routes-custom-endpoints-for-wp-rest-api/admin/settings.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Requires at least: Version format is invalid
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

advanced-custom-routes-custom-endpoints-for-wp-rest-api/index.php 92% from 13 tests

The primary PHP file in "Advanced Custom Routes - Custom Endpoints for WP REST API" version 0.8.0 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("advanced-custom-routes-custom-endpoints-for-wp-rest-api.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected4,169 lines of code in 38 files:
LanguageFilesBlank linesComment linesLines of code
JSON7002,279
PHP264681561,262
JavaScript310865379
CSS21357249

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.39
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%
Functions18
▷ Named functions1688.89%
▷ Anonymous functions211.11%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
8 PNG files occupy 0.20MB with 0.11MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png74.87KB22.15KB▼ 70.41%
assets/banner-1544x500.png17.30KB11.44KB▼ 33.85%
assets/banner-772x250.png12.54KB8.07KB▼ 35.62%
assets/screenshot-2.png45.44KB11.94KB▼ 73.73%
assets/screenshot-4.png21.48KB7.23KB▼ 66.33%