Last active
May 15, 2017 12:14
-
-
Save tdtgit/9f6fe1878bddf2a1f1ce6c654be13be2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Allow logged-in user see private posts in | |
add_action('pre_get_posts','filter_search'); | |
function filter_Search($query){ | |
if( is_admin() || ! $query->is_main_query() ) return; | |
if( current_user_can('edit_private_posts') ) { | |
$query->set('post_status',array('private','publish')); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment