84% advanced-custom-fields

Code Review | Advanced Custom Fields

WordPress plugin Advanced Custom Fields scored 84% from 54 tests.

About plugin

  • Plugin page: advanced-custom-f...
  • Plugin version: 5.12.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.9.2
  • WordPress version: 5.9.2
  • First release: Mar 25, 2011
  • Latest release: Mar 23, 2022
  • Number of updates: 523
  • Update frequency: every 7.7 days
  • Top authors: elliotcondon (96.56%)deliciousbrains (3.63%)

Code review

54 tests

User reviews

1140 reviews

Install metrics

2,000,000+ active / 27,392,971 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲3.56MB] [CPU: ▼278.10ms] Passed 4 tests

Analyzing server-side resources used by Advanced Custom Fields
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /6.87 ▲3.3573.72 ▲21.71
Dashboard /wp-admin7.01 ▲3.6054.57 ▲21.17
Posts /wp-admin/edit.php7.24 ▲3.6059.96 ▲23.52
Add New Post /wp-admin/post-new.php10.70 ▲3.73120.38 ▼1,172.86
Media Library /wp-admin/upload.php6.97 ▲3.6744.50 ▲17.59
Tools /wp-admin/edit.php?post_type=acf-field-group&page=acf-tools6.9746.11
Add New /wp-admin/post-new.php?post_type=acf-field-group7.2864.78
Field Groups /wp-admin/edit.php?post_type=acf-field-group6.9645.82

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 250 new files
Database: no new tables, 1 new option
New WordPress options
acf_version

Browser metrics Passed 4 tests

A check of browser resources used by Advanced Custom Fields
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,801 ▲5716.14 ▲0.405.55 ▼0.782.27 ▼0.13
Dashboard /wp-admin2,932 ▲716.13 ▼0.04116.20 ▼15.65158.97 ▼4.70
Posts /wp-admin/edit.php2,731 ▲373.23 ▲0.0062.92 ▲1.03139.11 ▲3.15
Add New Post /wp-admin/post-new.php4,187 ▲2,52621.83 ▲0.91606.19 ▲194.21191.19 ▲36.54
Media Library /wp-admin/upload.php2,385 ▲68710.61 ▲5.10223.64 ▲75.42189.06 ▲2.76
Tools /wp-admin/edit.php?post_type=acf-field-group&page=acf-tools1,5314.2969.42151.36
Add New /wp-admin/post-new.php?post_type=acf-field-group3,0985.6098.58203.72
Field Groups /wp-admin/edit.php?post_type=acf-field-group1,6193.2062.91126.60

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 1 option in the database
    • acf_version

Smoke tests 75% 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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 75× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields/includes/fields/class-acf-field-taxonomy.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/advanced-custom-fields/includes/admin/views/field-group-locations.php:9
    • > PHP Notice
      Undefined variable: rule in wp-content/plugins/advanced-custom-fields/includes/admin/views/html-location-rule.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields/includes/fields/class-acf-field-radio.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields/includes/fields/class-acf-field-post_object.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields/includes/fields/class-acf-field-tab.php:5
    • > PHP Notice
      Undefined variable: active in wp-content/plugins/advanced-custom-fields/includes/admin/views/html-admin-tools.php on line 16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_get_setting() in wp-content/plugins/advanced-custom-fields/includes/admin/views/html-notice-upgrade.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_register_store() in wp-content/plugins/advanced-custom-fields/includes/acf-hook-functions.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/advanced-custom-fields/includes/acf-input-functions.php:103

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 on the user side

Optimizations

Plugin configuration 93% 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
5 plugin tags: acf, fields, custom fields, meta, repeater

advanced-custom-fields/acf.php 85% from 13 tests

Analyzing the main PHP file in "Advanced Custom Fields" version 5.12.1
You should first fix the following items:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: The principal plugin file should be the same as the plugin slug ("advanced-custom-fields.php" instead of "acf.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected112,580 lines of code in 200 files:
LanguageFilesBlank linesComment linesLines of code
PO File3124,10941,34149,290
JavaScript165,8835,98738,452
PHP1368,45518,19418,740
CSS154957396,078
Markdown111014
SVG1006

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity14.86
▷ Minimum class complexity1.00
▷ Maximum class complexity78.00
Average method complexity2.88
▷ Minimum method complexity1.00
▷ Maximum method complexity24.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes102
▷ Abstract classes21.96%
▷ Concrete classes10098.04%
▷ Final classes00.00%
Methods748
▷ Static methods10.13%
▷ Public methods73097.59%
▷ Protected methods00.00%
▷ Private methods182.41%
Functions439
▷ Named functions43699.32%
▷ Anonymous functions30.68%
Constants8
▷ Global constants8100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
7 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/acf-logo.png3.40KB3.39KB0.23%
assets/inc/datepicker/images/ui-icons_444444_256x240.png3.68KB4.17KB0.00%
assets/inc/datepicker/images/ui-icons_DDDDDD_256x240.png3.68KB4.17KB0.00%
assets/inc/select2/3/select2x2.png0.64KB0.77KB0.00%
assets/inc/datepicker/images/ui-bg_highlight-soft_0_ffffff_1x100.png0.08KB0.08KB0.00%