94% advanced-custom-fields-position-field

Code Review | Advanced Custom Fields: Position Field

WordPress plugin Advanced Custom Fields: Position Field scored 94% from 54 tests.

About plugin

  • Plugin page: advanced-custom-f...
  • Plugin version: 1.1
  • PHP compatiblity: 5.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5.0-5.1
  • WordPress version: 5.9.2
  • First release: Sep 22, 2014
  • Latest release: Mar 13, 2019
  • Number of updates: 32
  • Update frequency: every 51.0 days
  • Top authors: mihdan (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 2,706 total downloads


Plugin footprint Passed 16 tests

Installer Passed 1 test

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

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

This is a short check of server-side resources used by Advanced Custom Fields: Position Field
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0161.06 ▲5.48
Dashboard /wp-admin3.41 ▲0.0138.20 ▼5.47
Posts /wp-admin/edit.php3.64 ▲0.0145.34 ▲3.88
Add New Post /wp-admin/post-new.php6.89 ▼0.0897.24 ▼1,197.37
Media Library /wp-admin/upload.php3.30 ▼0.0027.03 ▼9.45

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Advanced Custom Fields: Position Field
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,795 ▲4115.12 ▼0.126.02 ▼0.302.73 ▼0.14
Dashboard /wp-admin2,895 ▲416.10 ▲0.02113.05 ▼26.41153.55 ▼10.44
Posts /wp-admin/edit.php2,688 ▼33.36 ▲0.1362.45 ▼1.41133.17 ▼14.77
Add New Post /wp-admin/post-new.php1,674 ▼7821.57 ▲0.40419.95 ▼35.24176.17 ▼26.47
Media Library /wp-admin/upload.php1,701 ▼05.50 ▼0.04146.14 ▲4.91184.66 ▼60.33

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The plugin uninstalled completely, with no zombie files or tables

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 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields-position-field/register-fields.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function trailingslashit() in wp-content/plugins/advanced-custom-fields-position-field/acf-position.php:15

User-side errors Passed 1 test

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


Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Tags: You are using too many tags: 12 tag instead of maximum 10
Please take inspiration from this readme.txt

advanced-custom-fields-position-field/acf-position.php 92% from 13 tests

"Advanced Custom Fields: Position Field" version 1.1's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("advanced-custom-fields-position-field.php" instead of "acf-position.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
Good job! No executable or dangerous file extensions detected573 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity8.50
▷ Minimum class complexity1.00
▷ Maximum class complexity16.00
Average method complexity1.83
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
▷ Static methods00.00%
▷ Public methods18100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
▷ Named functions4100.00%
▷ Anonymous functions00.00%
▷ Global constants00.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
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/select2.png1.80KB1.24KB▼ 31.31%
images/select2x2.png0.83KB0.77KB▼ 6.15%