S
S
Shimpanze2019-01-11 08:14:29
WordPress
Shimpanze, 2019-01-11 08:14:29

A filter that will allow you to remove the "Title" field in the image upload window?

Hello!
Can you please tell me a snippet to remove the "Title" field in the image upload window?
5c382031ebcd0401817520.jpeg
Something like:

function my_images_attr( $attrs, $attachment, $size ) {
  if ( isset( $attrs['title'] ) ) {
    unset( $attrs['title'] );
    return $attrs;
  }
}
add_filter( 'wp_get_attachment_image_attributes', 'my_images_attr', 10, 3 );

But this code doesn't work for some reason...
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Chesnokov, 2019-01-12
@cesnokov

function hide_my_media_title(){
    ?>
    <style type="text/css">
        .attachment-details [data-setting="title"] {
            display: none;
        }
    </style>
    <?php
}
add_action('admin_head-post.php', 'hide_my_media_title' );
add_action('admin_head-post-new.php', 'hide_my_media_title' );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question