Hi @opus13
ACF saves the custom fields for users in the wp_usermeta table. If you want to query it, please take a look at this page: https://codex.wordpress.org/Class_Reference/WP_User_Query#Custom_Field_Parameters
I hope this helps π
Hi @opus13,
In addition,
Kindly have a look at the following plugin https://wordpress.org/plugins/relevanssi/
that may help you out.
Hope this helps.
Quick update for future reference: Damn. Relevanssi doesn’t work on repeater fields.
Hi @opus13
Please check the comment in the Relevanssi’s knowledge base here: http://www.relevanssi.com/knowledge-base/add-custom-fields-search-excerpts/#comment-2399476112.
I hope this helps π
Hi, I had tried that as well previously –http://i.imgur.com/7eC5FB6.png
No Luck. :/
Hi @opus13
Have you tried to add the content dynamically like the following?
$fields = get_field('userlist', $post->ID);
if($fields){
foreach($fields as $field){
$content .= " " . $field['user']['user_firstname'] . " " . $field['user']['user_lastname'];
}
}
That code will add the user first and last name in the search excerpt.
Hope this helps π
Hi, I haven’t tried it in the past.. but no luck. No additional content is populated in the post.
Hi @opus13
That code is supposed to be placed inside the relevanssi_excerpt_content
hook. Please check the comment link I gave you before. I think it should be something like this:
add_filter('relevanssi_excerpt_content', 'custom_fields_to_excerpts', 10, 3);
function custom_fields_to_excerpts($content, $post, $query) {
$fields = get_field('userlist', $post->ID);
if($fields){
foreach($fields as $field){
$content .= " " . $field['user']['user_firstname'] . " " . $field['user']['user_lastname'];
}
}
return $content;
}
Please keep in mind that this function is used to add the repeater’s content to the Relevanssi’s search excerpt, not your post excerpt.
I hope this makes sense π
Nope, no luck either.
Looking through the user fields in the DB I noticed that there are no references at all to ‘user_firstname’ or ”user_firstname’. Are those explicit internal values used by WordPress?
Hi @opus13
Could you please open a new ticket here: https://support.advancedcustomfields.com/new-ticket? In that ticket, could you please provide temporary credentials to your site? Also, please explain the issue in that ticket or add the link to this thread.
Thanks π
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
π£ βACF Chat Fridaysβ
— Advanced Custom Fields (@wp_acf) January 31, 2023
The ACF team holds their first open office hours this Friday! Come and talk ACF, and ask questions about building sites with the plugin.
Weβd love to see you there!
π Friday 3rd Feb - 3pm UTC
π Register here - https://t.co/3UtvQbE4CU pic.twitter.com/oTwW9K1XQ0
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.