Relevanssi has a conflict with User Access Manager plugin. Both plugins attach to the same `the_posts` filter hook with the same priority, and if UAM runs after Relevanssi, it may cause some issues, like missing excerpts or even broken search results pages.
The solution seems simple, however: at least in the one case I’ve run into so far, things started working after I moved Relevanssi to a slightly later priority, so it runs after UAM. That’s easy to do, just add the following code to your theme functions.php:
add_filter('after_setup_theme', 'rlv_move_to_later_priority'); function rlv_move_to_later_priority($priority) { remove_filter('the_posts', 'relevanssi_query'); add_filter('the_posts', 'relevanssi_query', 11); } |
Update 19.1.2021: This is no longer necessary, as Relevanssi runs on `posts_pre_query` hook now.
We are still having the same issue over UAM vs Relevanssi after we tried the above solution. Is there any other way to rectify this?
That fix doesn’t even do anything anymore, Relevanssi is now already by default on priority 99.
What kind of problems you are having with UAM and Relevanssi? I tried it now and everything seems to work without problems. Relevanssi doesn’t respect the UAM restrictions and will show the posts in search results (but of course you can’t see the actual post), but I’ll fix that in the next version.
Hi Mikko,
Thanks for your reply.
Our issue is UAM posts are still displaying in the search result.
for eg,
this post (https://www.parkwaycancercentre.com/from-survivor-to-volunteer/) should only visible to the login user, but its displaying in search result (https://www.parkwaycancercentre.com/?s=FROM+SURVIVOR+TO+VOLUNTEER).
Thanks
Ok, that isn’t even supposed to work in the current version, the current version doesn’t have any UAM compatibility built in.
This will be fixed in the next version, but meanwhile you can add this to your theme functions.php:
This should fix the problem.
Thanks a lot Mikko,
It works already with your function.