Unable to use wp_get_attachment_link filter for jetpack tiled galleries
-
I want to change the value of title attribute of attachment link of the image by caption.
I am using following code. It works fine but when i turn on thisDisplay all your gallery pictures in a cool mosaic.
then the code stops working
function oikos_get_attachment_link_filter( $content, $post_id, $size, $permalink ) { $attachment = get_post( $post_id); if ( $caption = $attachment->post_excerpt){ $new_content = preg_replace('/title=\'(.*?)\'/', 'title=\'' . $caption . '\'', $content ); return $new_content; } else { return $content; } } add_filter('wp_get_attachment_link', 'oikos_get_attachment_link_filter', 10, 4);
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Unable to use wp_get_attachment_link filter for jetpack tiled galleries’ is closed to new replies.