multi layer search
-
Hello,
I’m wondering if someone could give some guidance..perhaps recommend a plugin.
I need a multi layer search function for my site.
I have pages (with posts) that are restricted to certain groups – this content has to be searchable within this particular restricted category
Then I have pages & posts that are public, and the public search should not pull the restricted pages in results. I achieved this using the following code:
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
add_filter( 'pre_get_posts', 'ja_search_filter' ); /** * Exclude category 7 from search results. * * @since ?.?.? * @author Jared Atchison * @link https://gist.github.com/1300302 * * @param WP_Query $query Existing query object * @return WP_Query Amended query object */ function ja_search_filter( $query ) { if ( $query->is_search && !is_admin() ) $query->set( 'cat','-100,-106' ); return $query; }
However this prevents the private group to be able to search for the restricted content as well.
Is there anyway to solve this? Comments need to be included in both searches as well.
Thank you in advance!
- The topic ‘multi layer search’ is closed to new replies.