Skip to content

Instantly share code, notes, and snippets.

@ribeiroeder
Last active September 5, 2018 03:32
Show Gist options
  • Save ribeiroeder/5129162c100947b35892c00a19a28fd1 to your computer and use it in GitHub Desktop.
Save ribeiroeder/5129162c100947b35892c00a19a28fd1 to your computer and use it in GitHub Desktop.
Relevanssi index attachment Metabox.io File Advanced titles for parent post
add_filter( 'relevanssi_content_to_index', 'rlv_index_attachment_names', 10, 2 );
function rlv_index_attachment_names( $content, $post_id ) {
if ($post_id->post_type == "your_post_type") {
$files = rwmb_meta( '_your_meta_file_advanced' );
foreach ( $files as $file ) {
$content .= ' ' . $file['title'];
}
}
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment