Title: query_posts() &#8211; problem with “s” parameter
Last modified: August 20, 2016

---

# query_posts() – problem with “s” parameter

 *  [ktsixit](https://wordpress.org/support/users/ktsixit/)
 * (@ktsixit)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/query_posts-problem-with-s-parameter/)
 * I’m trying to create a search page for a custom post type. This is the code I’m
   using:
 *     ```
       $s = $_GET['s'];
       $args = array(
               'post_type' => 'companies',
               's'         => $s
       );
       query_posts($args);
   
       if ( have_posts() ) :
       ....results.....
       endif
       ```
   
 * The problem is that adding the “s” parameter in query_posts() gives me zero results
   no matter what the “s” value is. It seems like the whole search mechanism is 
   not working at all.
 * I’m getting results, only if I remove “s” parameter or set it to ”.
 * Any suggestions?

The topic ‘query_posts() – problem with “s” parameter’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [ktsixit](https://wordpress.org/support/users/ktsixit/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/query_posts-problem-with-s-parameter/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
