I was looking for a solution to remove the title attribute off of my portfolio images when hovering. I did some online research and someone claimed this code would work… so I pasted it into function.php… well now when I try to go to my website or my WP log-in it’s a blank page…. Need help please freaking out a tad!
<?php
add_filter(‘the_content’, ‘remove_titles’);
function remove_titles($txt) {
// Get all title=”…” tags from the html.
$txtresult= array();
preg_match_all(‘|title=”[^”]*”|U’, $txt, $txtresult);
// Replace all occurances with an empty string.
foreach($txtresult[0] as $img_tag) {
$text = str_replace($img_tag, ”, $txt);
}
return $txt;
}
?>