New Landing How can we help? Themeforest Theme Support Neighborhood Password protected pages, not hidden

Viewing 4 posts - 1 through 4 (of 4 total)
  • #174736
    jascin
    Member
    Post count: 47

    I have a problem with my pages.. It is password protected and it shows up on the blog. I have now set them privately. Can you guys look into this, so I can put it back up online. Thank you

    I’m talking about the wedding, engagement, portrait pages I have.

    #174757
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    function exclude_protected($where) {
    	global $wpdb;
    	return $where .= " AND {$wpdb->posts}.post_password = '' ";
    }
    
    // Where to display protected posts
    function exclude_protected_action($query) {
    	if( !is_single() && !is_page() && !is_admin() ) {
    		add_filter( 'posts_where', 'exclude_protected' );
    	}
    }
    
    // Action to queue the filter at the right time
    add_action('pre_get_posts', 'exclude_protected_action');

    Thanks
    Mohammad

    #174760
    jascin
    Member
    Post count: 47

    there is no child theme. Do I put i still put in under the functions.php? using notepad +++

    #174761
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Yes, you can do it.
    Thanks
    Mohammad

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register