Hi @nifel,
Make this change in plugin code:
https://gbiorczyk.pl/img/8jYkbzF.png
Send me:
1. SQL query displayed after change in code when you try to search for.
2. Database dump (only table wp_posts and wp_postmeta tables). Please delete private data from it, if any.
3. ID of post you want to find.
4. List of used plugins.
5. Version of ACF plugin and version of ACF: Better Search.
Thread Starter
nifel
(@nifel)
1. SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_postmeta AS a ON (a.post_id = wp_posts.ID) INNER JOIN wp_postmeta AS b ON ((b.meta_id = a.meta_id + @@auto_increment_increment) AND (b.post_id = wp_posts.ID)) WHERE 1=1 AND (((b.meta_value LIKE 'field_%') AND (a.meta_value LIKE '%bultsvets%')) OR ((wp_posts.post_title LIKE '%bultsvets%') OR (wp_posts.post_content LIKE '%bultsvets%') OR (wp_posts.post_excerpt LIKE '%bultsvets%'))) AND wp_posts.post_type IN ('post', 'page', 'attachment') AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_title LIKE '{2aee8da4a47a6f9940c76b78b0fe1b0ef297476c7a1ed7ec4e3b0212199eb79a}bultsvets{2aee8da4a47a6f9940c76b78b0fe1b0ef297476c7a1ed7ec4e3b0212199eb79a}' DESC, wp_posts.post_date DESC LIMIT 0, 4
2. https://we.tl/t-FK2X6UOqVj
3. 194
4/5.
ACF: Better Search – Version 3.1.2
Advanced Custom Fields PRO – Version 5.7.7
BJ Lazy Load
Contact Form 7
Heroic Favicon Generator
194 is not a post, only an ACF field ID. In the database, phrase “Bultsvets” contains only one image – there is no such value in the ACF fields.
Thread Starter
nifel
(@nifel)
So how can I search for the text I put in that ACF field?
First, put this content. You gave me phrase “Bultsvets”, and you have no such phrase in any ACF field.
Thread Starter
nifel
(@nifel)
It is a repeater sub-field, is that the problem?
As you can see in this screenshot I have the phrase “Bultsvets” inside that ACF field I sent you.
https://i.imgur.com/816Dik3.jpg
Thread Starter
nifel
(@nifel)
Or maybe it’s because its in “option”?
<?php the_sub_field('motstand_produkttitel', 'option'); ?>
Look here:
https://i.imgur.com/AGdnG6B.png
Where do you have “Bultsvets”? This works for ACF fields for posts, not Options Pages.
Thread Starter
nifel
(@nifel)
Well, that explains it then.
I have one acf_add_options_page with a redirect to all the rest of acf_add_options_sub_page basically. I did this because it looked better.
So I guess there’s no way to get a search on them when they are option pages?
How do you want to search for a posts based on options? Options pages are global for website.