WP Query show on search drafted posts


I have a custom made search on my WordPress site. I am using wp_query to do the search and show up results. But when I search for some posts it shows me drafted and private posts too.
Below my search string.

$args['post_type'] = array('post', 'page');
                    $args['post_status'] = 'publish';
                    $args['s'] = $search_string;
                    $args['orderby'] = 'date';
                    $args['order'] = 'DESC';
                    $args['suppress_filters'] = 0;
                    $args['paged'] = $paged;
                    $search_query = new WP_Query($args);
                    global $search_query;
Maaverick 2 months 0 Answers 9 views 0

Leave an answer