• I’m having the same exact issue that @livingmiracles had (in this post), except I’m not running Restrict Content Pro.

    In the link to the page I provided, there’s six results. Only three of them should actually be publicly available (the others are in draft status.

    Since I’m not using Restrict Content or RCPro, the workaround provided in LivingMiracle’s thread won’t work for me.

    This is, unfortunately, a time-sensitive issue.

    EDIT NOTE: Link removed, since I was able to track down the issue and do a workaround. Fix is below!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Okay, so I actually found a workaround for this, thanks to both @msaari’s post in THIS THREAD, and then re-building my search index.

    IMHO, you need to be able to pick posts/page status within the settings under Indexing.

    Thanks!

    Plugin Author Mikko Saari

    (@msaari)

    No, it’s not coming as a setting, since for 99% of the users it’s not significant, and being able to search for drafts in the admin backend is a useful feature.

    If the drafts are showing up on front end search to users who are not allowed to see them, that’s not normal Relevanssi behaviour and there’s something wrong somewhere – something is setting the post_status parameter to a value that includes drafts. The default value is just publish in the front end search.

    Good morning, Mikko! Apologies for not clarifying this… this is on the front side. I think I know what happened, though.

    At one point, these items were published as news and slider items, however, when a certain issue came to light, our communications department (along with our legal team) decided it would be in the best interest of the Organization to pull these items off the site, publicly.

    Since they had already been indexed by RelevanSSI, the links/search results (publicly) were still available, despite being pulled back into draft status.

    This actually leads me to my next suggestion: Is there a maintenance task RelevanSSI can “tap” into (WP Cron) to make sure that when post statuses get changed, indexes get updated, correctly?

    (I’d be happy to share the site/organization with the RelevanSSI team, privately, if requested. This might help explain a little more about the issue I faced.)

    Plugin Author Mikko Saari

    (@msaari)

    Relevanssi does respond automatically relevant post status changes. A change from publish to draft isn’t relevant, though, as the post will still stay indexed. However, unless something else is overriding the post status parameters, Relevanssi should never show non-public posts to users.

    I just tested this on my test site and it works as it should. If I search for something, then change the top results to a draft and search again, the post will be removed from the results. The post will still remain in the index and can still be found in admin search.

    If your front end search is showing drafts, there’s something wrong somewhere. The search will fetch all results, but the search results go through a filter that will by default show all publish posts, show only the private posts the user is allowed to see and to show no draft or pending posts, unless it’s an admin search.

    If you’re not using Restrict Content Pro, are you perhaps using some other access control plugin that might be involved here? Members, MemberPress, WP JV Post Reading Groups or Groups? Or perhaps some custom code on the relevanssi_post_ok filter hook? If no plugins or custom code is involved, Relevanssi should never show drafts in the front end search.

    On the front part of the site, we only have guest access. While we use UAM to control who has access to what departments/features within WP-Admin, on the front side, we don’t limit that (except the Extranet/Intranet, which is not tied to the search stuff).

    There are no other hooks (aside from the one I did) within the theme’s functions.php file for RelevanSSI.

    When I rebuilt the search index (tested on our dev site AND live site) and after the appropriate code was put into functions.php, the three results I expected to NOT see went away after the rebuild. I had made other changes (unsuccessfully), and reverted them back prior to finding the solution that did the fixes correctly.

    (I eat, breathe and sleep PHP/WP development… it’s a full time salaried gig for me, so I’m a bit more “creative” than the casual WP user.)

    Plugin Author Mikko Saari

    (@msaari)

    Actually, it is UAM. Just having UAM active makes all drafts visible to users visiting the site. Looks like the access checking logic in UAM doesn’t even consider drafts, and should only be applied to public posts. I’ll fix that in the next version: https://github.com/msaari/relevanssi/commit/aee775e475759780bd81e5252159b11ae75b3a82

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Search results linking to draft posts’ is closed to new replies.