• 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.