Skip to content

Instantly share code, notes, and snippets.

@Quasimo
Created February 17, 2013 03:18
Show Gist options
  • Save Quasimo/4969937 to your computer and use it in GitHub Desktop.
Save Quasimo/4969937 to your computer and use it in GitHub Desktop.

Revisions

  1. Quasimo created this gist Feb 17, 2013.
    9 changes: 9 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    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;
    }