Title: Problem with calling query_posts()
Last modified: August 19, 2016

---

# Problem with calling query_posts()

 *  Resolved [ashvini_saxena](https://wordpress.org/support/users/ashvini_saxena/)
 * (@ashvini_saxena)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/problem-with-calling-query_posts/)
 * Hey ,
 * I am running XAMPP latest version and WP 3.0.
    **Problem** When I try to use 
   query_posts() for retrieving posts by slugs. I am getting this error
 * Warning: trim() expects parameter 1 to be string, array given in C:\xampp\htdocs\
   wordpress\wp-includes\query.php on line 1272
 * for code
    <backticks> <?php
 * get_header();
    query_posts(array(‘name’=>array(‘guitar’,’movie-post’)));
 * if (have_posts()) :
    while (have_posts()) : the_post(); the_content(); endwhile;
   endif; get_sidebar(); get_footer(); ?> I</backticks>
 * What is wrong with this ? If I cannot use this , can you please suggest alternatives?
   This works when I put query as ‘name=guitar’

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/problem-with-calling-query_posts/#post-1599153)
 * There isn’t a parameter called ‘name’:
    [http://codex.wordpress.org/Function_Reference/query_posts](http://codex.wordpress.org/Function_Reference/query_posts)
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/problem-with-calling-query_posts/#post-1599181)
 * ‘name’ only allows one entry:
    [http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters)
 * try and use the post ids instead with the `post__in=array(3,7)` parameter.
 *  Thread Starter [ashvini_saxena](https://wordpress.org/support/users/ashvini_saxena/)
 * (@ashvini_saxena)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/problem-with-calling-query_posts/#post-1599269)
 * Thanks to both of you for your reply. I guess , I will have to use your method
   Alchymyth.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Problem with calling query_posts()’ is closed to new replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [slug](https://wordpress.org/support/topic-tag/slug/)
 * [trim](https://wordpress.org/support/topic-tag/trim/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [ashvini_saxena](https://wordpress.org/support/users/ashvini_saxena/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/problem-with-calling-query_posts/#post-1599269)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
