78% wp-attachments

Code Review | WP Attachments

WordPress plugin WP Attachments scored78%from 54 tests.

About plugin

  • Plugin page: wp-attachments
  • Plugin version: 5.0.6
  • PHP version: 7.4.16
  • WordPress compatibility: 4.4-6.2
  • WordPress version: 6.3.1
  • First release: Jan 7, 2012
  • Latest release: Feb 15, 2023
  • Number of updates: 145
  • Update frequency: every 28.0 days
  • Top authors: Milmor (100%)

Code review

54 tests

User reviews

42 reviews

Install metrics

5,000+ active /85,850 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.13MB] [CPU: ▼5.11ms] Passed 4 tests

Server-side resources used by WP Attachments
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0741.24 ▼1.37
Dashboard /wp-admin3.45 ▲0.1450.45 ▲0.23
Posts /wp-admin/edit.php3.56 ▲0.2150.66 ▼3.58
Add New Post /wp-admin/post-new.php6.03 ▲0.15100.70 ▼15.73
Media Library /wp-admin/upload.php3.37 ▲0.1437.59 ▲1.27
WP Attachments /wp-admin/options-general.php?page=wpatt-option-page3.3440.63

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 61 new files
Database: no new tables, 11 new options
New WordPress options
db_upgraded
widget_recent-comments
wpatt_option_localization
widget_recent-posts
wpa_ict
wpatt_option_date_localization
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
wpa_template
...

Browser metrics Passed 4 tests

An overview of browser requirements for WP Attachments
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,801 ▲4014.34 ▼0.382.21 ▲0.1743.90 ▲0.16
Dashboard /wp-admin2,206 ▲265.63 ▲0.0585.40 ▼11.2439.39 ▼6.00
Posts /wp-admin/edit.php2,111 ▲81.97 ▼0.0241.33 ▼1.2144.39 ▲7.22
Add New Post /wp-admin/post-new.php6,258 ▲4,72320.86 ▲2.56878.57 ▲241.7876.61 ▲0.30
Media Library /wp-admin/upload.php1,436 ▲364.23 ▲0.0296.91 ▼1.6042.35 ▼1.54
WP Attachments /wp-admin/options-general.php?page=wpatt-option-page1,0163.7264.1377.98

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
These items require your attention
  • Zombie WordPress options were found after uninstall: 11 options
    • wpa_template
    • wpatt_option_date_localization
    • wpa_ict
    • wpatt_option_localization
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded
    • wpa_version_number
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-attachments/inc/attach_unattach_reattach.php:53
    • > PHP Notice
      Undefined variable: url in wp-content/plugins/wp-attachments/inc/html/attachmentEditIframe.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/wp-attachments/wp-attachments.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/wp-attachments/inc/ij-post-attachments.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-attachments/inc/html/attachmentEditIframe.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/wp-attachments/inc/counter.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function site_url() in wp-content/plugins/wp-attachments/inc/html/attachmentEditHead.php:1

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There are user-side issues you should fix
    • > GET request to /wp-admin/options-general.php?page=wpatt-option-page
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/options-general.php?page=wpatt-option-page
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Please fix the following attributes:
  • Tags: There are too many tags (25 tag instead of maximum 10)
Please take inspiration from this readme.txt

wp-attachments/wp-attachments.php Passed 13 tests

The main PHP file in "WP Attachments" ver. 5.0.6 adds more information about the plugin and also serves as the entry point for this plugin
76 characters long description:
Powerful solution to manage and show your WordPress media in posts and pages

Code Analysis Passed 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
Success! There were no dangerous files found in this plugin950 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
PHP7163112824
JavaScript1246482
CSS28344

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity17.00
▷ Minimum class complexity17.00
▷ Maximum class complexity17.00
Average method complexity2.60
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods10
▷ Static methods110.00%
▷ Public methods990.00%
▷ Protected methods00.00%
▷ Private methods110.00%
Functions23
▷ Named functions1878.26%
▷ Anonymous functions521.74%
Constants3
▷ Global constants3100.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
45 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
styles/0/document-excel.png0.66KB0.58KB▼ 11.31%
styles/3/document-odt.png0.53KB0.66KB0.00%
styles/2/document-word.png0.71KB0.60KB▼ 15.87%
styles/4/document-image.png0.60KB0.61KB0.00%
styles/1/document-word.png0.34KB0.29KB▼ 14.20%