, LLC.

Remove Title Attributes from Images in  WordPress

Have you ever noticed that an unwanted popup tooltip appears when you hover over an image in WordPress? This is created by the title attribute that is automatically added for many image attachments (including post thumbnails). Removing this attribute from all of your images can be done with the following handy function.

 * Remove image titles
 * Remove the "title" attribute from all image attachments and functions
 * using the wp_get_attachment_image() function
 * @param $attr An array of attributes for the 
 * @return $attr Filtered attributes without the title
function remove_attachment_title_attr( $attr ) {
	return $attr;
add_action('wp_get_attachment_image_attributes', 'remove_attachment_title_attr');

Just add it to your theme’s functions.php file.

Meet the Author

Kevin Leary, WordPress Consultant

I'm a freelance web developer and WordPress consultant in Boston, MA with 16 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.