Title: Plugin messes with pre_get_posts
Last modified: August 21, 2016

---

# Plugin messes with pre_get_posts

 *  Resolved [dragnet_elisabeth](https://wordpress.org/support/users/dragnet_elisabeth/)
 * (@dragnet_elisabeth)
 * [12 years ago](https://wordpress.org/support/topic/plugin-messes-with-pre_get_posts/)
 * I have a couple of pages I don’t want to show in the search results, so I used
   the pre_get_posts filter and posts__not_in. Got it working.
 * Next step was to make custom fields searchable. Found this plugin and installed.
   But after that the posts__not_in did not work.
 * My code below (posts_per_page setting works):
 *     ```
       function search_exclude_pages($query) {
           if ($query->is_search) {
               $query->set('posts_per_page', '-1');
               $query->set('post__not_in',array(74,78));
           }
           return $query;
       }
       add_filter('pre_get_posts','search_exclude_pages');
       ```
   
 * [https://wordpress.org/plugins/custom-fields-search/](https://wordpress.org/plugins/custom-fields-search/)

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

 *  Plugin Author [bestwebsoft](https://wordpress.org/support/users/bestwebsoft/)
 * (@bestwebsoft)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/plugin-messes-with-pre_get_posts/#post-4881839)
 * Hi,
 * Unfortunately, this functionality is not available, but if you want you can order
   a paid customization and provide details in a private ticket on our support forum
   [http://support.bestwebsoft.com/](http://support.bestwebsoft.com/)
 * Sincerely,
    BestWebSoft Support Team
 *  [OniX777](https://wordpress.org/support/users/onix777/)
 * (@onix777)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/plugin-messes-with-pre_get_posts/#post-4881860)
 * I have the exact same problem, did not find a solution?

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

The topic ‘Plugin messes with pre_get_posts’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-fields-search_ebebeb.svg)
 * [Custom Fields Search by BestWebSoft](https://wordpress.org/plugins/custom-fields-search/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-fields-search/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-fields-search/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-fields-search/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-fields-search/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-fields-search/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [OniX777](https://wordpress.org/support/users/onix777/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/plugin-messes-with-pre_get_posts/#post-4881860)
 * Status: resolved