Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'd like to add a column in the Media Library that shows that alt tag that way I can quickly add alt tags for all images that don't have one. How could I go about this?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Here's the code -

function wpse_media_extra_column( $cols ) {
    $cols["alt"] = "ALT";
    return $cols;
}
function wpse_media_extra_column_value( $column_name, $id ) {
    if( $column_name == 'alt' )
        echo get_post_meta( $id, '_wp_attachment_image_alt', true);
}
add_filter( 'manage_media_columns', 'wpse_media_extra_column' );
add_action( 'manage_media_custom_column', 'wpse_media_extra_column_value', 10, 2 );

It could go to functions.php file or into your plugin.

share|improve this answer
    
That was super fast, thank you! Worked perfect. –  paper_robots Mar 6 at 17:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.