83% advanced-custom-fields

Code Review | Advanced Custom Fields (ACF)

WordPress plugin Advanced Custom Fields (ACF) scored83%from 54 tests.

About plugin

  • Plugin page: advanced-custom-f...
  • Plugin version: 6.2.4
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8-6.4
  • WordPress version: 6.3.1
  • First release: Mar 25, 2011
  • Latest release: Nov 28, 2023
  • Number of updates: 566
  • Update frequency: every 8.2 days
  • Top authors: elliotcondon (89.22%)deliciousbrains (10.95%)

Code review

54 tests

User reviews

1200 reviews

Install metrics

2,000,000+ active /43,225,028 total downloads

Benchmarks

Plugin footprint 83% 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: ▲4.52MB] [CPU: ▲21.33ms] Passed 4 tests

Server-side resources used by Advanced Custom Fields (ACF)
Server-side resource usage in normal parameters
Page Memory (MB) CPU Time (ms)
Home / 7.56 ▲4.10 62.30 ▲21.72
Dashboard /wp-admin 7.96 ▲4.62 78.49 ▲19.94
Posts /wp-admin/edit.php 8.02 ▲4.66 80.07 ▲30.79
Add New Post /wp-admin/post-new.php 10.77 ▲4.88 113.90 ▲12.86
Media Library /wp-admin/upload.php 7.91 ▲4.68 75.11 ▲41.76
Tools /wp-admin/edit.php?post_type=acf-field-group&page=acf-tools 7.96 64.51
Options Pages /wp-admin/edit.php?post_type=acf-field-group&page=acf_options_preview 7.89 64.65
Field Groups /wp-admin/edit.php?post_type=acf-field-group 7.94 65.18
Taxonomies /wp-admin/edit.php?post_type=acf-taxonomy 7.95 72.10
Post Types /wp-admin/edit.php?post_type=acf-post-type 7.95 72.50

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 444 new files
Database: no new tables, 7 new options
New WordPress options
acf_version
can_compress_scripts
db_upgraded
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Advanced Custom Fields (ACF)
Minimal impact on browser resources
Page Nodes Memory (MB) Script (ms) Layout (ms)
Home / 2,828 ▲66 14.13 ▼0.58 1.49 ▼0.36 37.78 ▼6.39
Dashboard /wp-admin 2,233 ▲56 5.63 ▲0.01 94.64 ▲1.96 41.58 ▼1.04
Posts /wp-admin/edit.php 2,141 ▲41 2.03 ▲0.08 38.90 ▼3.12 35.84 ▼4.09
Add New Post /wp-admin/post-new.php 11,353 ▲9,816 26.47 ▲3.34 1,220.76 ▲575.74 42.43 ▼13.28
Media Library /wp-admin/upload.php 1,991 ▲594 8.33 ▲4.14 231.08 ▲132.76 49.44 ▲9.10
Tools /wp-admin/edit.php?post_type=acf-field-group&page=acf-tools 1,656 2.86 47.28 110.78
Options Pages /wp-admin/edit.php?post_type=acf-field-group&page=acf_options_preview 1,262 2.66 42.08 51.16
Field Groups /wp-admin/edit.php?post_type=acf-field-group 1,716 2.31 38.50 42.76
Taxonomies /wp-admin/edit.php?post_type=acf-taxonomy 1,750 2.21 37.44 40.46
Post Types /wp-admin/edit.php?post_type=acf-post-type 1,746 2.33 37.65 40.95

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • acf_version

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

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
Please fix the following items
  • 90× PHP files trigger errors when accessed directly with GET requests (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-post_object.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-custom-fields/includes/acf-bidirectional-functions.php:203
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/advanced-custom-fields/includes/api/api-template.php:875
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_register_store() in wp-content/plugins/advanced-custom-fields/includes/acf-helper-functions.php:142
    • > PHP Notice
      Undefined variable: rule in wp-content/plugins/advanced-custom-fields/includes/admin/views/acf-field-group/location-rule.php on line 7
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields/includes/fields/class-acf-field-accordion.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'acf_field' not found in wp-content/plugins/advanced-custom-fields/includes/fields/class-acf-field-password.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_get_combined_post_type_settings_tabs() in wp-content/plugins/advanced-custom-fields/includes/admin/views/acf-post-type/advanced-settings.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_get_url() in wp-content/plugins/advanced-custom-fields/includes/admin/views/acf-field-group/list-empty.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function acf_get_location_rule_types() in wp-content/plugins/advanced-custom-fields/includes/admin/views/acf-field-group/location-rule.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
5 plugin tags: repeater, custom fields, fields, acf, meta

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

Analyzing the main PHP file in "Advanced Custom Fields (ACF)" version 6.2.4
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("advanced-custom-fields.php" instead of "acf.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin192,921 lines of code in 340 files:
Language Files Blank lines Comment lines Lines of code
PO File 46 47,112 71,545 113,565
JavaScript 18 5,326 7,486 39,328
PHP 164 8,018 20,827 26,446
CSS 15 715 1,529 13,266
SVG 96 0 0 301
Markdown 1 12 0 15

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code 0.38
Average class complexity 18.63
▷ Minimum class complexity 1.00
▷ Maximum class complexity 110.00
Average method complexity 3.08
▷ Minimum method complexity 1.00
▷ Maximum method complexity 59.00
Code structure
Namespaces 1
Interfaces 0
Traits 0
Classes 114
▷ Abstract classes 3 2.63%
▷ Concrete classes 111 97.37%
▷ Final classes 2 1.80%
Methods 956
▷ Static methods 2 0.21%
▷ Public methods 932 97.49%
▷ Protected methods 0 0.00%
▷ Private methods 24 2.51%
Functions 558
▷ Named functions 548 98.21%
▷ Anonymous functions 10 1.79%
Constants 12
▷ Global constants 10 83.33%
▷ Class constants 2 16.67%
▷ Public constants 2 100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
43 PNG files occupy 0.86MB with 0.28MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
File Size - original Size - compressed Savings
assets/images/field-type-previews/field-preview-flexible-content.png 39.20KB 17.72KB ▼ 54.80%
assets/inc/select2/3/select2x2.png 0.64KB 0.77KB 0.00%
assets/inc/datepicker/images/ui-bg_highlight-soft_0_ffffff_1x100.png 0.08KB 0.08KB 0.00%
assets/images/field-type-previews/field-preview-group.png 26.84KB 12.82KB ▼ 52.23%
assets/images/field-type-previews/field-preview-gallery.png 7.83KB 3.66KB ▼ 53.27%