How to Index all custom fields ?

Home Forums Product Support Forums Ajax Search Pro for WordPress Support How to Index all custom fields ?

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 5 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #21276


    I have 2 questions here.

    1. In my website I use so many custom fields, I can not find the option to index all custom fields at once. I see only option to add individual custom fields in to the settings.

    Where is the option to index all custom field at once ?

    2. I have use Advance Custom Field PRO and have the problem with custom field search.
    I use the repeatable field a lot. Here this is the scenario.

    Custom Fields setup in ACF
    procedure_groups = repeatable
    procedure_group_name = text field under procedure_groups
    procedure_group_description = text field under procedure_groups

    However when ACF PRO generate postmeta in database it keep metakey like


    and so on… depends on how many repeatable.

    So, When I specify which field can search now only option is all fields.

    However, If you can support ACF Pro repeatable field it would be great or in general we can use procedure_group_* as wildcard for these kind of fled. This issue can apply for question 1 also. Now I can not find a way to use repeatable field.

    Could you please suggest how to setup this scenario in the setting ?

    Thankyou in advance.

    Ernest Marcinko
    Ernest Marcinko


    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),

    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.

    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.