Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function limit_search_author( $query ) {
- if ( $query->is_search ) {
- $current_user = wp_get_current_user();
- if ( !( $current_user instanceof WP_User ) )
- return $query;
- if ( 0 != $current_user->ID ) {
- $query->set( 'author', $current_user->ID );
- }
- }
- return $query;
- }
- add_filter( 'pre_get_posts', 'limit_search_author' );
- ?>
Add Comment
Please, Sign In to add comment