Enhancement: Add new acf/fields/icon_picker/{tab_name}/icons filter#177
Merged
cbravobernal merged 29 commits intoWordPress:trunkfrom Jun 20, 2025
Merged
Conversation
ockham
commented
Jun 17, 2025
| $custom_icons = apply_filters( 'acf/fields/icon_picker/' . $name . '/icons', array(), $field ); | ||
|
|
||
| if ( is_array( $custom_icons ) && ! empty( $custom_icons ) ) { | ||
| $this->render_icon_list_tab( $name, $custom_icons ); |
Contributor
Author
There was a problem hiding this comment.
PHPStan is right about this: The function only supports one argument.
Since I carried the code over from upstream, it looks like it's a bug there.
This means that the newly introduced acf/fields/icon_picker/{tab_name}/icons filter won't actually work there. This leaves us with two options:
- We punt this PR for now (until it's fixed upstream), or
- we fix it here.
Contributor
Author
There was a problem hiding this comment.
This means that the newly introduced
acf/fields/icon_picker/{tab_name}/iconsfilter won't actually work there.
I misspoke, it's actually working -- jQuery is doing all of the heavy lifting.
Simply removing the extra arg should be enough.
cbravobernal
approved these changes
Jun 20, 2025
Contributor
cbravobernal
left a comment
There was a problem hiding this comment.
Tested and work as expected. Cannot comment on code as is a backport.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work in progress. Testing instructions to follow.
PHP changes correspond to this changeset: https://plugins.trac.wordpress.org/changeset/3289772/advanced-custom-fields/tags/6.4.1/includes/fields/class-acf-field-icon_picker.php
Testing Instructions
Add the following code as a plugin, and enable it:
Code
In the SCF Field Groups panel, add an Icon Picker field to a fieldset that's used for a given post type. Make sure to enabled the checkbox for the "My custom icons" tab.
Create or edit an instance of that post type. Verify that searching and selecting an icon from the icon selector works as before, and that the selected icon is persisted when saving.
Finally, select the new "My custom icons" tab and verify that you can also select an icon there.