Hi @newshoremedia,
When you turn off multisite, does search work?
Hi @mateuszgbiorczyk,
it works in the local environment, which is a single site with the exact same theme, plugins and settings.
EDIT: my first guess is that the plugin doesn’t take into account that in a multisite the table prefix changes for every network site, so it always only searches the tables of the very first network site..
Hi ,
Please try make this changes in plugin code:
https://i.imgur.com/8jYkbzF.png
Then simulate search and check query. Is prefix correct?
I appear to have the same issue, are you going to release an update for this?
Thanks.
Andrew.
I need information to be able to do something.
Sorry, misread that last reply. I’ve tried adding the code snippet but it doesn’t appear to get called as it doesn’t output anything from there. I will try and take a look this week and see if I can debug further.
@aandrewdixon, Do you try init searching after you added this change in plugin code?
@mateuszgbiorczyk – Sorry it has been so long, but I had to work on something different and now I’m back on the original project that was using the plugin. So I have now added your debug code and get the output and this is the query I got:
SELECT DISTINCT SQL_CALC_FOUND_ROWS
wp_10_posts.*
FROM wp_10_posts
INNER JOIN wp_10_postmeta AS a ON (a.post_id = wp_10_posts.ID)
INNER JOIN wp_10_postmeta AS b ON ((b.meta_id = a.meta_id + @@auto_increment_increment)
AND (b.post_id = wp_10_posts.ID))
INNER JOIN wp_10_posts AS c ON (
(c.post_type = ‘acf-field’)
AND (
(c.post_content LIKE ‘%:”text”%’)
OR
(c.post_content LIKE ‘%:”textarea”%’)
OR
(c.post_content LIKE ‘%:”wysiwyg”%’)
)
)
WHERE 1=1
AND (
(
(
c.post_name = b.meta_value
)
AND
(
a.meta_value LIKE ‘%test%’
)
)
OR (
(
wp_10_posts.post_title LIKE ‘%test%’
)
OR
(
wp_10_posts.post_content LIKE ‘%test%’
)
OR
(
wp_10_posts.post_excerpt LIKE ‘%test%’
)
)
)
AND wp_10_posts.post_type IN (‘post’, ‘page’)
AND (
wp_10_posts.post_status = ‘publish’
OR
wp_10_posts.post_status = ‘acf-disabled’
OR
wp_10_posts.post_status = ‘private’
)
ORDER BY wp_10_posts.post_title LIKE ‘{f2430de4ac2e5caa5885164f7569b233c8de81e5f12374f72f76a9dd2e55e406}test{f2430de4ac2e5caa5885164f7569b233c8de81e5f12374f72f76a9dd2e55e406}’ DESC, wp_10_posts.post_date DESC
LIMIT 0, 10
It appears to be referencing the correct tables, e.g. the _[site-number]_ tables, so I’m not sure why it isn’t working.
@mateuszgbiorczyk I’ve managed to figure out the issue, it isn’t multisite related at all, it is ACF related. We are using ACF Flexible Content for everything and the data for this is stored in the _postmeta table and not the posts table.