Last active
June 8, 2016 14:18
-
-
Save wpweb101/2e66fec61c31e2d04a1932ad93713c83 to your computer and use it in GitHub Desktop.
Facetwp Re-indexing EDD - Frontend Submissions checkbox values
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_filter( 'facetwp_index_row', 'wwce_facetwp_index_row' ); | |
function wwce_facetwp_index_row( $params ) { | |
global $wpdb; | |
if ( 'genre' == $params['facet_name'] || 'instruments' == $params['facet_name'] || 'mood' == $params['facet_name'] ) { | |
$values = $params['facet_display_value']; | |
foreach ( $values as $val ) { | |
$wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->prefix}facetwp_index | |
(post_id, facet_name, facet_source, facet_value, facet_display_value) VALUES (%d, %s, %s, %s, %s)", | |
$params['post_id'], | |
$params['facet_name'], | |
$params['facet_source'], | |
$val, | |
$val | |
) ); | |
} | |
// skip the default indexing query | |
return false; | |
} | |
return $params; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment