Until WP 3.6 it was possible to remove the "alt" field (and also the "caption" field) before showing a post of type "attachment" through attachment_fields_to_edit hook.
As you can see also here (user Olemak's comment to the solution) WP removed the possibility to...remove fields from that hook from 3.6 version on.
Do you know other methods to get this result in WP, or I have to resort to a Css-only solution?
Until WP 3.6 it was possible to remove the "alt" field (and also the "caption" field) before showing a post of type "attachment" through attachment_fields_to_edit hook.
As you can see also here (user Olemak's comment to the solution) WP removed the possibility to...remove fields from that hook from 3.6 version on.
Do you know other methods to get this result in WP, or I have to resort to a Css-only solution?
The attachment_fields_to_edit
function returns an array variable called: $form_fields
, which contains all the data. So as it is an array, we could make any of these operations in this link.
There are some methods to delete an array element, including unset()
method, which I think it's the easy method to use.
And to delete the caption field, I'm not so sure but I think you should unset this: $form_fields['post_excerpt']
, this contains the caption content. Take a look at the code function in this code link.