Title: PHP in Querypost
Last modified: August 19, 2016

---

# PHP in Querypost

 *  [stevenoi](https://wordpress.org/support/users/stevenoi/)
 * (@stevenoi)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-in-querypost/)
 * Hi, I use get_option to get the settings for my querypost :
    `<?php query_posts('
   cat=-'.get_option('excludecat')); ?>` But now I also want to insert the showposts
   with get_option `<?php query_posts('showposts='.get_option('p-post-show')); ?
   >` And I can’t get this into on single code…
 * Steven

Viewing 1 replies (of 1 total)

 *  Thread Starter [stevenoi](https://wordpress.org/support/users/stevenoi/)
 * (@stevenoi)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-in-querypost/#post-1142598)
 * Found the solution :
 *     ```
       <?php
       $wp_query->query_vars["cat"] = get_option('excludecat');
       $wp_query->query_vars["showposts"] = get_option('p-post-show');
       $wp_query->get_posts();
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘PHP in Querypost’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [stevenoi](https://wordpress.org/support/users/stevenoi/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/php-in-querypost/#post-1142598)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
