Last active
December 10, 2015 17:08
-
-
Save thefrosty/4465516 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
function extendd_exclude_extendd_settings_plugin( $query ) { | |
if ( 'plugin' == $query->query['post_type'] ) { | |
$current_user = wp_get_current_user(); | |
// Not logged in = $current_user->ID == 0 | |
if ( 0 == $current_user->ID ) /* && ( false === $query->query_vars['suppress_filters'] ) */ ) { | |
$protected_posts = get_extendd_settings_plugin(); //returns integer | |
if ( !empty( $protected_posts ) ) { | |
$query->query_vars['post__not_in'] = array( $protected_posts ); | |
} | |
} | |
} | |
return $query; | |
} | |
add_action( 'pre_get_posts', 'extendd_exclude_extendd_settings_plugin' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment