Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › How to Index all custom fields ? › Reply To: How to Index all custom fields ?
Hi!
1. There is no option for that on purpose, to avoid indexing failures. You can however try a custom code to force indexing all of the possible fields. Try adding this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
add_filter( 'asp_it_args', 'asp_index_all_cf', 10, 2);
function asp_index_all_cf($args, $defaults) {
$meta_keys = asp_get_custom_fields(5000);
$meta_keys_arr = array();
foreach ( $meta_keys as $mk ) {
$meta_keys_arr[] = $mk['meta_key'];
}
$args['index_customfields'] = implode('|', $meta_keys_arr);
return $args;
}
function asp_get_custom_fields( $limit = 1000 ) {
global $wpdb;
return $wpdb->get_results(
$wpdb->prepare("SELECT meta_key FROM " . $wpdb->postmeta . " GROUP BY meta_key LIMIT %d", $limit),
ARRAY_A
);
}
I am not sure if I do recommend this solution, but it’s worth a try.
2. Repeater fields are not supported officially. There is this knowledge base article, that may work in some of the cases, but still, repeaters have different structures alltogether, so there is no guarantee it works in all cases.