add_media_credit doesn't obey "include default credit"
-
The ‘add_media_credit’ function that builds the input fields for the media editor automatically adds the media uploaders name to the credit line. This is problematic when you do not want to provide credit to a specific media asset, but do want to make an adjustment to something like Yoast SEO values or Alt/Description tags. You have to manually clear the credit field out since it is pre-populated.
I made the following update to add_media_credit on my end, which seems to make a bit more sense to me.
$credit = get_freeform_media_credit($post); $credit_user = get_wpuser_media_credit($post); $html = "<input id='attachments[$post->ID][media-credit]' class='media-credit-input' size='30' value='$credit' placeholder='$credit_user' name='attachments[$post->ID][media-credit]' />";
Basically, I pull the freeform credit, and use that for the input value, and then use the wpuser as the placeholder. This shows the uploader in ‘grey’ (by default), and if the ‘do not display default credit’ option is unchecked, this is what will appear.
- The topic ‘add_media_credit doesn't obey "include default credit"’ is closed to new replies.