Search result password protected pages

  • Unknown's avatar

    Hi,

    I am unsure how to make the standard wordpress search function return password protected pages as a result.

    I have tried this code but it won’t work.

    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;
    }

    any suggestions are welcomed and appreciated.

    Thanks!

  • Unknown's avatar

    Sorry scottastephenson86, but here we provide support only for blogs hosted by WordPress.COM and that site is not among them, since you cannot edit php code here. We do not provide support for WordPress.ORG software installs. Unfortunately you are posting to the wrong support forum.

    WordPress.COM and WordPress.ORG are completely separate and have different username accounts, logins, features, run different versions of some themes with the same names, and have separate support documentation and separate support forums. Read the differences here http://en.support.wordpress.com/com-vs-org/

    If you don’t have a username account at WordPress.ORG account, then click http://wordpress.org/support/ and register one on the top right hand corner of the page that opens, https://wordpress.org/support/register.php so you can post to the support forums there and get advice from WordPress.ORG bloggers like you.
    Resetting your WordPress.ORG password http://codex.wordpress.org/Resetting_Your_Password
    WordPress.org support docs are at https://codex.wordpress.org/Main_Page

  • The topic ‘Search result password protected pages’ is closed to new replies.