I'm using filter like this to add rel
attribute in wp_get_attachment_link()
add_filter( 'wp_get_attachment_link', 'sant_prettyadd');
function sant_prettyadd ($content) {
$content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$content,1);
return $content;
}
The above filter working fine except it adds the attribute even if the href
points to attachment page.
I mean I want to add rel
attribute only if the link points to direct image and not attachment page.
Can someone help me with this?