88% custom-post-type-page-template

Code Review | Custom Post Type Page Template

WordPress plugin Custom Post Type Page Template scored 88% from 54 tests.

About plugin

  • Plugin page: custom-post-type-...
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-4.9.4
  • WordPress version: 5.8.1
  • First release: Nov 3, 2012
  • Latest release: Feb 21, 2018
  • Number of updates: 9
  • Update frequency: every 215.2 days
  • Top authors: Hiroaki Miyashita (100%)

Code review

54 tests

User reviews

21 reviews

Install metrics

4,000+ active / 34,846 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼140.87ms] Passed 4 tests

Analyzing server-side resources used by Custom Post Type Page Template
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.87 ▲0.1537.87 ▲9.66
Dashboard /wp-admin3.09 ▲0.0449.47 ▲3.74
Posts /wp-admin/edit.php3.14 ▲0.0444.90 ▼4.19
Add New Post /wp-admin/post-new.php5.46 ▲0.03105.66 ▼559.06
Media Library /wp-admin/upload.php3.04 ▲0.0336.36 ▼3.95

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 7 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Custom Post Type Page Template
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,694 ▲9815.81 ▲0.418.28 ▲0.3754.51 ▲5.76
Dashboard /wp-admin2,972 ▲385.88 ▼0.13160.55 ▲7.18115.45 ▼8.65
Posts /wp-admin/edit.php2,744 ▲52.68 ▼0.0167.05 ▼2.00103.44 ▲8.26
Add New Post /wp-admin/post-new.php1,686 ▲318.71 ▼0.09380.10 ▼9.45114.30 ▼4.55
Media Library /wp-admin/upload.php1,812 ▲25.02 ▲0.01153.72 ▲1.16123.48 ▼6.43
Custom Post Type Page Template /wp-admin/custom-post-type-page-template.php260.900.759.77

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Uninstall script ran successfully

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please take a closer look at the following
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/custom-post-type-page-template/custom-post-type-page-template.php:33

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
These are user-side errors you should fix
    • > GET request to /wp-admin/custom-post-type-page-template.php
    • > Network (severe)
    wp-admin/custom-post-type-page-template.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Custom Post Type Page Template - Settings), #2 (Custom Post Type Page Template - Page Template Box)
The official readme.txt might help

custom-post-type-page-template/custom-post-type-page-template.php 85% from 13 tests

The main file in "Custom Post Type Page Template" v. 1.1 serves as a complement to information provided in readme.txt and as the entry point to the plugin
The following require your attention:
  • Domain Path: Note that the domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("/")
  • Domain Path: Prefix the domain path with a forward slash character ("//")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin200 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP12123143
PO File11,3252,84857

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity29.00
▷ Minimum class complexity29.00
▷ Maximum class complexity29.00
Average method complexity3.55
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods11
▷ Static methods00.00%
▷ Public methods11100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
2 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png6.95KB5.92KB▼ 14.88%
screenshot-2.png3.98KB3.14KB▼ 21.04%