We’re using a Gravity Form that allows visitors to upload files. When a file is uploaded, the visitor is given a chance to delete the file by clicking on a “Trash Can” dashicon.
The above is forcing us to use the WordPress dashicon file, /wp-includes/css/dashicons.min.css, which adds a heavy payload (57.6 KB) to our affected page.
We would like to dequeue WordPress’ dashicon file and use instead a native Gravity Form symbol (say, a red “X”) to perform the same file delete function. This would make our page a lot lighter.
Can anyone tell us if such an option (or code snippet) exists? We believe there used to be a red “X” available at one time, but perhaps a recent Gravity Forms update delete it (?)
Can you post your code again without the backticks? It really got mangled and I can’t tell if there is anything wrong with it in use, or if it’s only mangled here.
You can use three backticks on a new line to make a whole block code, then close with three backticks on a new line when you’re done. Or, paste the code in and then click the code icon in the formatting bar, which looks like this:
First, there is a JavaScript version and a PHP version. Both need to be used.
Second, the actual form ID and field ID are not part of the PHP code. The parameters $form_id and $field_id should be left as is. They are passed in to the filter: you don’t set them.
Finally, the red X was previously used to be the delete icon, but it was confusing to some users, thinking it meant there was an error. For that reason, the red X was changed to a trash icon.
The use of dashicons is currently being evaluated and may be changed in a future version, due to the weight of that file.