Skip to main content

I'm trying to modify all image attachment links to include a rel value thus:

add_filter( 'wp_get_attachment_link', 'my_prettyadd', 100, 6);
 
function my_prettyadd( $markup, $id, $size, $permalink, $icon, $text ) {
    $content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$markup,1);
    return $content;
}

This has worked fine for me for ages, but recent installation of WP have meant this fails insofarin so far that the function is never called (I placed an exit; line in there and it has no effect. I know that my theme does not use wp_get_attachment_link and so I'm suspecting I'm barking up the wrong tree now.

I'm using Canvas by WooThemes - I don't know if they dohave done anything out of the ordinary with attachments in posts. Anything obviously wrong in what I"m doing?

I'm trying to modify all image attachment links to include a rel value thus:

add_filter( 'wp_get_attachment_link', 'my_prettyadd', 100, 6);
 
function my_prettyadd( $markup, $id, $size, $permalink, $icon, $text ) {
    $content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$markup,1);
    return $content;
}

This has worked fine for me for ages, but recent installation of WP have meant this fails insofar that the function is never called (I placed an exit; line in there and it has no effect. I know that my theme does not use wp_get_attachment_link and so I'm suspecting I'm barking up the wrong tree now.

I'm using Canvas by WooThemes - I don't they do anything out of the ordinary with attachments in posts. Anything obviously wrong in what I"m doing?

I'm trying to modify all image attachment links to include a rel value thus:

add_filter( 'wp_get_attachment_link', 'my_prettyadd', 100, 6);
 
function my_prettyadd( $markup, $id, $size, $permalink, $icon, $text ) {
    $content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$markup,1);
    return $content;
}

This has worked fine for me for ages, but recent installation of WP have meant this fails in so far that the function is never called (I placed an exit; line in there and it has no effect. I know that my theme does not use wp_get_attachment_link and so I'm suspecting I'm barking up the wrong tree now.

I'm using Canvas by WooThemes - I don't know if they have done anything out of the ordinary with attachments in posts. Anything obviously wrong in what I"m doing?

Source Link

wp_get_attachment_link filter not working

I'm trying to modify all image attachment links to include a rel value thus:

add_filter( 'wp_get_attachment_link', 'my_prettyadd', 100, 6);
 
function my_prettyadd( $markup, $id, $size, $permalink, $icon, $text ) {
    $content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$markup,1);
    return $content;
}

This has worked fine for me for ages, but recent installation of WP have meant this fails insofar that the function is never called (I placed an exit; line in there and it has no effect. I know that my theme does not use wp_get_attachment_link and so I'm suspecting I'm barking up the wrong tree now.

I'm using Canvas by WooThemes - I don't they do anything out of the ordinary with attachments in posts. Anything obviously wrong in what I"m doing?