Add NoFollow to Custom Links

FooGallery Documentation

Add NoFollow to Custom Links

If you are using custom URL’s for your gallery thumbs, then you might also want to make those links nofollow, so that search engines do no crawl those links from your site.

To add this functionality, simply add the following code snippet to your functions.php file:

add_filter( 'foogallery_attachment_html_link_attributes', 'foogallery_nofollow_links', 10, 3 );

function foogallery_nofollow_links($attr, $args, $foogallery_attachment) {
  	if ( 'custom' === $args['link'] && !empty($foogallery_attachment->custom_url) ) {
	  $attr['rel'] = 'nofollow';
	return $attr;

Please note that you will need to set your gallery “Link To” setting to use custom URL’s:

Set link to Custom URL