You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: class-acf-field-icon_picker.php calls wp_get_attachment_image_url() with string Dashicon slug, causing fatal TypeError on PHP 8+ #1032
In includes/fields/class-acf-field-icon_picker.php, when rendering the tabs for the Icon Picker field (used on post types, taxonomies, and custom fields), ACF executes wp_get_attachment_image_url() unconditionally inside the media_library tab loop, even when the field's active value is a Dashicon string (such as 'dashicons-admin-post').
Because $field['value']['value'] is a string and not an attachment ID, WordPress passes this string through wp_get_attachment_image_src. Any plugin hooking into this filter with strict type hints (such as WP Offload Media 3.4+) immediately crashes with an Uncaught TypeError: Argument must be of type int, string given.
Steps to Reproduce
Run a WordPress site on PHP 8.2+ with ACF and any plugin that hooks into wp_get_attachment_image_src expecting an integer (e.g., WP Offload Media 3.4+).
Navigate to wp-admin/post-new.php?post_type=acf-post-type (ACF > Post Types > Add New).
The page fails with a 500 Fatal Error (TypeError).
Root Cause
In includes/fields/class-acf-field-icon_picker.php (around lines 215–220):
The template attempts to hide the preview using CSS (display: none;), but PHP still evaluates wp_get_attachment_image_url( 'dashicons-admin-post', 'thumbnail' ).
Suggested Fix
Wrap the call so wp_get_attachment_image_url() is only invoked if the field type is actually media_library and the value is numeric:
Activity
johnstonphilip commentedon Sep 16, 2026
Thanks for the report and PR. We will get this fixed in an upcoming release.