Forums › Forums › Search & Filter Pro › Don't show password-protected posts in search results?
- This topic has 8 replies, 2 voices, and was last updated 5 years, 4 months ago by Anonymous.
Viewing 9 posts - 1 through 9 (of 9 total)
-
Anonymous(Private) June 27, 2019 at 3:02 pm #215108
Unfortunately as the site is in development and behind our firewall, you can’t access it. I took a screenshot of the search results, though, and I can send it to you if you let me know the best way to do that. The posts are public (custom post type) but password-protected. Thanks.
Trevor(Private) June 27, 2019 at 4:32 pm #215143I think you will need to use this filter (the code goes in to your child theme functions.php file):
https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments
Like this:
function exclude_password_protected_posts( $query_args, $sfid ) { if($sfid==225) { $query_args['has_password'] = FALSE; } return $query_args; } add_filter( 'sf_edit_query_args', 'exclude_password_protected_posts', 20, 2 );
where you need to change the ID number (in the example it is 225, so use the ID number of your form).
-
AuthorPosts
Viewing 9 posts - 1 through 9 (of 9 total)