Title: query_posts issue
Last modified: August 20, 2016

---

# query_posts issue

 *  [mrFlamer](https://wordpress.org/support/users/mrflamer/)
 * (@mrflamer)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/query_posts-issue-3/)
 * Hey.
    I’m having a little issue with the WP script.
 * **Brief description**
    I want to serve dynamic some pages and I made a preg_match
   over the query_string. So far, so good. But when I include my custom page from
   the templates directory, query_posts function ignores all my arguments that I
   pass to it and returns all posts with that custom_type. I’m using a plugin to
   pass multiple custom fields to query_posts function.
 * **Details are poetry… 🙂**
    Ok, so I have some products and a custom post type
   for them. My URL should be something like `/products/{gender}/{size}`. I wrote
   a little function that I “auto-appeal” in my template’s function.php file called`
   specialPage()`. It checks the `$_SERVER["REQUEST_URI"]` and if this string applies
   for some conditions, it includes a different page called ‘list-products.php’ 
   located in my template directory. So far, so good. The bad thing is that to avoid
   the 404 message, I added a ‘die’ after requiring the needed page. And, inside
   the page, query_posts function behaves like I give no arguments to it and returns
   all unnecessary posts. I know it may have been a rude solution to include that
   page and I’m sure there are better ways to do what I want to; that’s why I’m 
   opened to opinions regarding my error. PHP-FPM throws the following error: `[
   28-Jul-2011 23:09:14] PHP Catchable fatal error: Object of class WP_Error could
   not be converted to string in[...]`. This happens when I loop the posts and want
   to print any `$post`‘s data ($post is, of course, a stdclass object).
 * My first guess is that there are some globals that aren’t loaded/processes that
   aren’t executed since I kill the script. 🙂
 * Cheers.

The topic ‘query_posts issue’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [mrFlamer](https://wordpress.org/support/users/mrflamer/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/query_posts-issue-3/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
