Index attachment titles for parent
<?php | |
// Add this function to your theme functions.php and reindex. | |
add_filter( 'relevanssi_content_to_index', 'rlv_index_attachment_names', 10, 2 ); | |
function rlv_index_attachment_names( $content, $post_id ) { | |
$attachments = get_children( | |
array( | |
'post_parent' => $post_id, | |
'post_type' => 'attachment', | |
) | |
); | |
foreach ( $attachments as $attachment ) { | |
$content .= ' ' . $attachment->post_title; | |
} | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment