Title: {Plugin Relevanssi] &#8211; Filter Posts
Last modified: August 20, 2016

---

# {Plugin Relevanssi] – Filter Posts

 *  [markbo](https://wordpress.org/support/users/markbo/)
 * (@markbo)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/filter-posts-2/)
 * On my site (www.thedanceattic.com), I am using a plugin (Role Scoper) to limit
   access to certain post categories unless you are logged in to my site. I would
   like these same categories to be excluded from the search results if you are 
   not logged in. For example if you search on “Rehearsal” you should not find very
   many posts however you find all of them. If you click on the first post, you 
   are unable to open it due to the security however the excerpt gave you most of
   the post.
 * This functionality worked using the default WP search engine however I prefer
   the Relevanssi functionality. Is there a way to filter these category results
   when the user is not logged in?
 * Also, I am having an issue getting the date relevance filter to work. I put the
   code in the functions.php file and re-indexed but it doe not sort as I expected.
 * > function date_weights($match) {
   >  $post_date = strtotime(get_the_time(“Y-m-d”,
   > $match->doc)); if (time() – $post_date < 60*60*24*7) { $match->weight = $match-
   > >weight * 2; } else { $match->weight = $match->weight / 2; } return $match;}
   > add_filter(‘relevanssi_match’, ‘date_weights’);
 * Thanks,
    Mark

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/filter-posts-2/#post-2167490)
 * Relevanssi supports Role Scoper and for private posts checks if the user has “
   read_post” rights for the current post. I did this for someone’s request, I don’t
   use Role Scoper myself, so I don’t know anything else about it.
 * The date filter doesn’t work, because the ‘relevanssi_match’ filter is a Premium
   feature.
 *  [spred](https://wordpress.org/support/users/spred/)
 * (@spred)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/filter-posts-2/#post-2167763)
 * Hello,
    In fact, I’m also using Role Scoper and Relevanssi and I have a problem,
   too.
 * If a user finds any word in my blog (a user who only can access to some categories),
   all related contents are displayed, even if the user hasn’t rights to do it, 
   but if the user tries to follow the link of one of these posts to read the whole
   text, log in is required (due to Role Scoper functions).
 * So, I would like to limit the search only for the suitable categories in each
   case, depending on the user who is logged.
 * Is it possible?
 * Thank you very much,
 *  Plugin Author [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * (@msaari)
 * [14 years, 6 months ago](https://wordpress.org/support/topic/filter-posts-2/#post-2167764)
 * Someone with more experience on Role Scoper should probably rewrite the Role 
   Scoper interface code in Relevanssi in the `relevanssi_default_post_ok()` function
   to worry about categories as well. I don’t know how Role Scoper works, and don’t
   have time to learn it just to fix this one thing.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘{Plugin Relevanssi] – Filter Posts’ is closed to new replies.

 * ![](https://ps.w.org/relevanssi/assets/icon-256x256.png?rev=3529670)
 * [Relevanssi - A Better Search](https://wordpress.org/plugins/relevanssi/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/relevanssi/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/relevanssi/)
 * [Active Topics](https://wordpress.org/support/plugin/relevanssi/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/relevanssi/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/relevanssi/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Mikko Saari](https://wordpress.org/support/users/msaari/)
 * Last activity: [14 years, 6 months ago](https://wordpress.org/support/topic/filter-posts-2/#post-2167764)
 * Status: not resolved