83% the-post-grid

Code Review | The Post Grid

WordPress plugin The Post Grid scored 83% from 54 tests.

About plugin

  • Plugin page: the-post-grid
  • Plugin version: 3.1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.9.1
  • WordPress version: 5.9.2
  • First release: Mar 2, 2016
  • Latest release: Mar 7, 2022
  • Number of updates: 127
  • Update frequency: every 17.3 days
  • Top authors: techlabpro1 (100%)

Code review

54 tests

User reviews

83 reviews

Install metrics

30,000+ active / 546,662 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲1.26MB] [CPU: ▼290.06ms] Passed 4 tests

An overview of server-side resources used by The Post Grid
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.79 ▲1.2762.29 ▲15.88
Dashboard /wp-admin4.70 ▲1.3042.32 ▲8.33
Posts /wp-admin/edit.php4.93 ▲1.2945.87 ▲9.94
Add New Post /wp-admin/post-new.php8.18 ▲1.21103.23 ▼1,181.13
Media Library /wp-admin/upload.php4.59 ▲1.2933.68 ▲2.61
All Grids /wp-admin/edit.php?post_type=rttpg4.6332.79
Settings /wp-admin/edit.php?post_type=rttpg&page=rttpg_settings4.5832.25
Add New Grid /wp-admin/post-new.php?post_type=rttpg4.9862.93
Get Help /wp-admin/edit.php?post_type=rttpg&page=rttpg_get_help4.5831.48

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 169 new files
Database: no new tables, 4 new options
New WordPress options
rttpg_plugin_activation_time
widget_widget_tpg_post_grid
rt_the_post_grid_settings
rt_the_post_grid_current_version

Browser metrics Passed 4 tests

An overview of browser requirements for The Post Grid
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,927 ▲18215.77 ▲0.116.13 ▲0.622.75 ▼0.06
Dashboard /wp-admin3,018 ▲1576.13 ▼0.01116.27 ▼21.52187.81 ▲23.41
Posts /wp-admin/edit.php2,781 ▲873.14 ▼0.1065.92 ▲2.83149.28 ▲12.69
Add New Post /wp-admin/post-new.php1,768 ▼518.50 ▼3.39417.76 ▼36.11176.76 ▲20.36
Media Library /wp-admin/upload.php1,739 ▲415.51 ▲0.02125.63 ▼18.06206.70 ▲17.66
All Grids /wp-admin/edit.php?post_type=rttpg1,5443.2163.29127.11
Settings /wp-admin/edit.php?post_type=rttpg&page=rttpg_settings1,4922.6958.12191.98
Add New Grid /wp-admin/post-new.php?post_type=rttpg10,6997.39281.80274.06
Get Help /wp-admin/edit.php?post_type=rttpg&page=rttpg_get_help2,2299.50257.86243.27

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin does not fully uninstall, leaving 4 options in the database
    • rt_the_post_grid_settings
    • rttpg_plugin_activation_time
    • rt_the_post_grid_current_version
    • widget_widget_tpg_post_grid

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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 fix the following items
  • 107× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function rtTPG() in wp-content/plugins/the-post-grid/lib/views/settings/item-fields.php:3
    • > PHP Warning
      in_array() expects parameter 2 to be array, null given in wp-content/plugins/the-post-grid/lib/templates/layouts/layout3.php on line 33
    • > PHP Notice
      Undefined variable: items in wp-content/plugins/the-post-grid/lib/templates/layouts/layout5.php on line 33
    • > PHP Notice
      Undefined variable: items in wp-content/plugins/the-post-grid/lib/templates/layouts/layout7.php on line 47
    • > PHP Notice
      Undefined variable: items in wp-content/plugins/the-post-grid/lib/templates/layouts/layout1.php on line 18
    • > PHP Notice
      Undefined variable: items in wp-content/plugins/the-post-grid/lib/templates/layouts/layout3.php on line 18
    • > PHP Warning
      in_array() expects parameter 2 to be array, null given in wp-content/plugins/the-post-grid/lib/templates/layouts/layout6.php on line 33
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/the-post-grid/lib/views/settings/settings.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/the-post-grid/lib/widgets/RT_TPGWidget.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/the-post-grid/lib/templates/layouts/layout2.php:39

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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
Attributes that need to be fixed:
  • Donate link: Invalid URI found ("")
The official readme.txt might help

the-post-grid/the-post-grid.php 92% from 13 tests

The main PHP file in "The Post Grid" ver. 3.1.4 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Description: Please keep the plugin description shorter than 140 characters (currently 141 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin26,455 lines of code in 56 files:
LanguageFilesBlank linesComment linesLines of code
SVG40010,207
PHP358024467,796
CSS67551014,158
JavaScript96968753,990
PO File2124128304

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 357)
Cyclomatic complexity
Average complexity per logical line of code0.60
Average class complexity76.05
▷ Minimum class complexity1.00
▷ Maximum class complexity365.00
Average method complexity8.18
▷ Minimum method complexity1.00
▷ Maximum method complexity357.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes20
▷ Abstract classes00.00%
▷ Concrete classes20100.00%
▷ Final classes00.00%
Methods210
▷ Static methods136.19%
▷ Public methods19090.48%
▷ Protected methods31.43%
▷ Private methods178.10%
Functions5
▷ Named functions120.00%
▷ Anonymous functions480.00%
Constants8
▷ Global constants8100.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
86 PNG files occupy 0.22MB with 0.09MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/layouts/grid10.png2.14KB1.36KB▼ 36.21%
assets/images/layouts/grid_layout8.png2.18KB1.20KB▼ 44.80%
assets/images/layouts/grid5.png2.24KB1.25KB▼ 44.06%
assets/images/layouts/edd3.png2.63KB1.50KB▼ 42.80%
assets/images/layouts/grid3.png2.43KB1.44KB▼ 40.60%