Skip to content

Instantly share code, notes, and snippets.

@msaari
Created March 9, 2017 18:37
Show Gist options
  • Save msaari/0f5910e58290a74477e0e023cf392a53 to your computer and use it in GitHub Desktop.
Save msaari/0f5910e58290a74477e0e023cf392a53 to your computer and use it in GitHub Desktop.
Relevanssi: do not index image attachments
<?php
// Add this to theme functions.php
add_filter('relevanssi_do_not_index', 'rlv_no_image_attachments', 10, 2);
function rlv_no_image_attachments($block, $post_id) {
$mime = get_post_mime_type($post_id);
if (substr($mime, 0, 5) == "image") $block = true;
return $block;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment