Created
March 9, 2017 18:37
-
-
Save msaari/0f5910e58290a74477e0e023cf392a53 to your computer and use it in GitHub Desktop.
Relevanssi: do not index image attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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