Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ajax Search Pro and ACF
This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year, 4 months ago.
- AuthorPosts
- December 23, 2022 at 4:24 pm #40639
I can’t get the search to work with my Advanced Custom Fields for users.
Here’s a video of what is happening:
https://www.dropbox.com/s/ehy102f0opqob8p/Ajax%20Search%20Pro%20and%20ACF.mp4?dl=0
December 27, 2022 at 2:55 pm #40644Just following up on this as it’s been four days since I sent this in.
December 27, 2022 at 3:05 pm #40647Hi,
Sorry for the late response – we usually don’t work during the christmas holydays.
Can you try adding the values manually instead of using the “{get_values}” pseudo variable? The issue here seems to be with the actual checkbox values not returned correctly from ACF.
If you want, you can add temporary FTP and back-end access and I can try debugging the code to see why the incorrect values have been sent to the front-end.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
December 27, 2022 at 6:37 pm #40652I tried manually adding the values and it wasn’t actually searching correctly.
See timestamp 2:27 of the video I sent you:
https://www.dropbox.com/s/ehy102f0opqob8p/Ajax%20Search%20Pro%20and%20ACF.mp4?dl=0I added you as an admin user to guild.storygrid.com
Username: ajaxsearchpro
Password: DcqIhZKYsdPbWgC(f#*%DfjOLet me know. Thanks so much!
December 28, 2022 at 1:11 pm #40656Thank you very much!
The issue was, that the values had a space character after them, which is not removed (intentionally). When I corrected the values, it started working: https://i.imgur.com/vN0ekWq.png
Best,
I tried a few values, it looks okay, but let me know.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
December 29, 2022 at 10:21 pm #40667AH! That worked! Thanks so much!
One more question…
I have a custom field public_profile that has values “yes” and “no”.
I need to make sure that only users with public_profile set to “yes” show up in the results. Is there a way to do that?
December 29, 2022 at 10:48 pm #40668Ok, I found these two pages:
And added this to my functions.php file:
add_filter('asp_query_args', 'asp_add_my_meta_filter', 10, 1); function asp_add_my_meta_filter( $args ) { $args['search_type'] = array('users'); $args['post_meta_filter'] = array( array( 'key' => 'public_profile', // meta key 'value' => 'yes', // int|float|string|array|timestamp|datetime 'operator' => 'LIKE', 'allow_missing' => false // allow match if this custom field is unset )); return $args; }
But it’s still returning users with public_profile set to “no”.
Any ideas?
December 31, 2022 at 12:10 pm #40670I think you can do it much simpler via a “hidden” field: https://i.imgur.com/66Hc9SD.png
Best,
With that no custom codes are needed.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.