• Resolved nummernegen

    (@nummernegen)


    Hello,

    Thanks to this snippet I’ve added 1 custom field _my_meta_field to var $searchable_meta_keys.
    How do I add a second or more custom fields to the search terms?
    Perhaps only just a matter of proper php coding, nevertheless I feel stranded.
    Perhaps anyone could point me out.
    Thank you

    function my_wpjm_meta_key_dm() {
        global $wpdb, $job_manager_keyword;
        $searchable_meta_keys[] = '_my_meta_field';
        return $searchable_meta_keys;
    }
    add_filter('job_listing_searchable_meta_keys', 'my_wpjm_meta_key_dm');
Viewing 1 replies (of 1 total)
  • Gaurav

    (@gaurav984)

    Hi there,

    Thanks for reaching out. The $searchable_meta_keys[] is an array. In the code you shared the array has one value _my_meta_field you can add more values to this variable for adding a second or more custom fields to the search terms.

    Best,

Viewing 1 replies (of 1 total)
  • The topic ‘add multiple search terms (custom fields)’ is closed to new replies.