How can I add a class to the Description field in a media item?

[ad_1]

I want to add a class to the description field in an image.

This is my code, but it doesn’t seem to be doing anything. Can anyone help?

function custom_image_description_class($form_fields, $post) {
$form_fields[‘post_content’][‘label’] = ‘Description’;
$form_fields[‘post_content’][‘input’] = ‘textarea’;
$form_fields[‘post_content’][‘class’] = ‘my-class’;
return $form_fields;
}
add_filter(‘attachment_fields_to_edit’, ‘custom_image_description_class’, 10, 2);

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer