Title: wordpress theme development pre get posts
Last modified: August 24, 2016

---

# wordpress theme development pre get posts

 *  [richard wid](https://wordpress.org/support/users/richard-wid/)
 * (@richard-wid)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/wordpress-theme-development-pre-get-posts/)
 * I’m having an issue with using pre_get_posts I’m currently using a pre_get_posts
   function to control the loop output of my category template which works fine 
   but I also have a search template and I’m trying to incorporate the arguments
   used in there into a separate pre_get_posts function.
 * This is what I am using, when used it kills the site, white screen, as you might
   have noticed I’m no expert…
 * If anyone is able to point out my most likely glaring mistake I’ll be very grateful.
 * function paginate_search ( $query ) {
    if( $query->!is_admin() ) { foreach($_POST[‘
   filter_cat’] as $fcat){$fcat_list .= $fcat . “,”;} query_posts( array_merge (
   array ( ‘cat’ => $fcat_list, ‘posts_per_page’ => 6, ‘paged’ => $paged ), $wp_query-
   >query ) ); } } add_action( ‘pre_get_posts’, ‘paginate_search’ );

The topic ‘wordpress theme development pre get posts’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [richard wid](https://wordpress.org/support/users/richard-wid/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/wordpress-theme-development-pre-get-posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
