Index Table - Indexing child post contents to parent
add_filter('asp_post_content_before_tokenize_clear', 'asp_add_children_to_parent', 10, 2);
function asp_add_children_to_parent($content, $post) {
$children_array = get_children( array('post_parent' => $post->ID) );
if ( !is_wp_error($children_array) )
foreach ( $children_array as $child ) {
$content .= " ".$child->post_content;
}
return $content;
}Limiting by post type only
add_filter('asp_post_content_before_tokenize_clear', 'asp_add_children_to_parent', 10, 2);
function asp_add_children_to_parent($content, $post) {
if ( $post->post_type == 'topic' ) {
$children_array = get_children( array('post_parent' => $post->ID) );
if ( !is_wp_error($children_array) )
foreach ( $children_array as $child ) {
$content .= " ".$child->post_content;
}
}
return $content;
}Last updated