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
PageMemory (MB)CPU Time (ms)
Home /7.56 ▲4.1062.30 ▲21.72
Dashboard /wp-admin7.96 ▲4.6278.49 ▲19.94
Posts /wp-admin/edit.php8.02 ▲4.6680.07 ▲30.79
Add New Post /wp-admin/post-new.php10.77 ▲4.88113.90 ▲12.86
Media Library /wp-admin/upload.php7.91 ▲4.6875.11 ▲41.76
Tools /wp-admin/edit.php?post_type=acf-field-group&page=acf-tools7.9664.51
Options Pages /wp-admin/edit.php?post_type=acf-field-group&page=acf_options_preview7.8964.65
Field Groups /wp-admin/edit.php?post_type=acf-field-group7.9465.18
Taxonomies /wp-admin/edit.php?post_type=acf-taxonomy7.9572.10
Post Types /wp-admin/edit.php?post_type=acf-post-type7.9572.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
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,828 ▲6614.13 ▼0.581.49 ▼0.3637.78 ▼6.39
Dashboard /wp-admin2,233 ▲565.63 ▲0.0194.64 ▲1.9641.58 ▼1.04
Posts /wp-admin/edit.php2,141 ▲412.03 ▲0.0838.90 ▼3.1235.84 ▼4.09
Add New Post /wp-admin/post-new.php11,353 ▲9,81626.47 ▲3.341,220.76 ▲575.7442.43 ▼13.28
Media Library /wp-admin/upload.php1,991 ▲5948.33 ▲4.14231.08 ▲132.7649.44 ▲9.10
Tools /wp-admin/edit.php?post_type=acf-field-group&page=acf-tools1,6562.8647.28110.78
Options Pages /wp-admin/edit.php?post_type=acf-field-group&page=acf_options_preview1,2622.6642.0851.16
Field Groups /wp-admin/edit.php?post_type=acf-field-group1,7162.3138.5042.76
Taxonomies /wp-admin/edit.php?post_type=acf-taxonomy1,7502.2137.4440.46
Post Types /wp-admin/edit.php?post_type=acf-post-type1,7462.3337.6540.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:
LanguageFilesBlank linesComment linesLines of code
PO File4647,11271,545113,565
JavaScript185,3267,48639,328
PHP1648,01820,82726,446
CSS157151,52913,266
SVG9600301
Markdown112015

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 code0.38
Average class complexity18.63
▷ Minimum class complexity1.00
▷ Maximum class complexity110.00
Average method complexity3.08
▷ Minimum method complexity1.00
▷ Maximum method complexity59.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes114
▷ Abstract classes32.63%
▷ Concrete classes11197.37%
▷ Final classes21.80%
Methods956
▷ Static methods20.21%
▷ Public methods93297.49%
▷ Protected methods00.00%
▷ Private methods242.51%
Functions558
▷ Named functions54898.21%
▷ Anonymous functions101.79%
Constants12
▷ Global constants1083.33%
▷ Class constants216.67%
▷ Public constants2100.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
FileSize - originalSize - compressedSavings
assets/images/field-type-previews/field-preview-flexible-content.png39.20KB17.72KB▼ 54.80%
assets/inc/select2/3/select2x2.png0.64KB0.77KB0.00%
assets/inc/datepicker/images/ui-bg_highlight-soft_0_ffffff_1x100.png0.08KB0.08KB0.00%
assets/images/field-type-previews/field-preview-group.png26.84KB12.82KB▼ 52.23%
assets/images/field-type-previews/field-preview-gallery.png7.83KB3.66KB▼ 53.27%