Title: Pre_get_posts
Last modified: August 21, 2016

---

# Pre_get_posts

 *  [Givago](https://wordpress.org/support/users/givago/)
 * (@givago)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/pre_get_posts/)
 * functions.php
    function my_home_category( $query ) { if ( $query->is_home() &&
   $query->is_main_query() ) { $query->set( ‘cat’, ‘1’ ); } } add_action( ‘pre_get_posts’,‘
   my_home_category’ );
 * I’m trying to set up to appear more than one category entretando still fails.
   
   I tried: $ query-> set (‘cat’, ‘1, 2 ‘); or $ query-> set (‘cat’, array (‘1 ‘,‘
   2’)));
 * but it still fails

The topic ‘Pre_get_posts’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [Givago](https://wordpress.org/support/users/givago/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/pre_get_posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
