Hi,
First a big thanks for your nice post script 🙂
This is a missed functionality, I will add this to dev version as soon as I get time and later I will make it official.
Will keep you posted.
Thanks a lot!
Thread Starter
RHP
(@rhp)
Hi Sumit,
Thank you for your reply! I appreciate you making the time.
I’ve actually found a work around using a two different plugins. But if you update it, I’d be happy to support it, as yours is much more intuitive.
Thread Starter
RHP
(@rhp)
Hi Sumit,
I just wanted to note the code that I added via a plugin called “My Custom Functions”. This, combined with the below code, allowed the searching of protected pages with wordpress, only your plugin seemed to conflict with this, so I had to use something else. I know zero about coding but thought I’d share this in case it’s useful.
// include password protected pages in search results
add_filter( ‘posts_search’, ‘include_password_posts_in_search’ );
function include_password_posts_in_search( $search ) {
global $wpdb;
if( !is_user_logged_in() ) {
$pattern = ” AND ({$wpdb->prefix}posts.post_password = ”)”;
$search = str_replace( $pattern, ”, $search );
}
return $search;
}
Hi,
Sorry for the delayed reply!
I am sorry I did not get your request at first. You want password protected pages to show up even when user is not logged-in then this code is fine just increase the priority of filter you are adding.
I mean instead of this line
add_filter( ‘posts_search’, ‘include_password_posts_in_search’ );
use this
add_filter( 'posts_search', 'include_password_posts_in_search', 501 );
Thank you!