Title: How to use query_posts filter ?
Last modified: August 19, 2016

---

# How to use query_posts filter ?

 *  [gilbert-tordeur](https://wordpress.org/support/users/gilbert-tordeur/)
 * (@gilbert-tordeur)
 * [16 years ago](https://wordpress.org/support/topic/how-to-use-query_posts-filter/)
 * Hello.
 * My current WP configuration:
    – WordPress : 2.9.2 in French – Theme : 3d-realty.
   1.0.3 modified and localized – Plugins : Calendar, cforms, Cimy User Extra Fields,
   IWG Hide Dashboard, New User Email Setup, Role Manager, RSS Footer, Sidebar Login,
   Simple:Press Forum, StatPress, WP-Table Reloaded, wpNamedUsers – Hosted by : 
   OVH – Site : [http://www.reseau-gestalt-ouest.asso.fr/](http://www.reseau-gestalt-ouest.asso.fr/)–
   Issue : My own plugin generates an error
 * I use WordPress for a site that does not publish any post, only pages. I would
   like that my RSS feed contains links to the recently modified pages, but not 
   all; I wish to exclude some pages that have no interest in such a feed.
 * To do this I have defined a custom field « rgo_montrer_dans_fil_rss ». I set 
   its value to “oui” if I want the page to be published in the feed. And I have
   developed a small plugin (my first one) to apply this filter, but it does not
   work.
 * Here is the plugin code:
 *     ```
       <?php
       /*
       Plugin Name: RGO RSS filter
       Description: Exclut certaines pages du flux RSS : celles qui ne contiennent pas le champ personnalisé 'rgo_montrer_dans_fil_rss' avec une valeur 'oui'
       Author: Gilbert Tordeur
       Version: 1.0
       */
       if (!function_exists('rgo_rss_filter')) {
          function rgo_rss_filter() {
             if (is_feed()) {
                query_posts('post_type=page&showposts=10&meta_key=rgo_montrer_dans_fil_rss&meta_compare==&meta_value=oui');
             }
          }
          add_action('rss2_head','rgo_rss_filter');
       }
       ?>
       ```
   
 * For now the activation of my plugin immediatly generates the following error 
   on my admin pages:
 * Warning: Cannot modify header information – headers already sent by (output started
   at /homez.330/reseaugen/www/w2/wp-content/plugins/rgo-rss-filter/rgo-rss-filter.
   php:1) in /homez.330/reseaugen/www/w2/wp-content/plugins/simple-forum/library/
   sf-ahah-handler.php on line 14
 * Warning: Cannot modify header information – headers already sent by (output started
   at /homez.330/reseaugen/www/w2/wp-content/plugins/rgo-rss-filter/rgo-rss-filter.
   php:1) in /homez.330/reseaugen/www/w2/wp-content/plugins/sidebar-login/sidebar-
   login.php on line 321
 * I do not understand this error. How can I fix it?
 * Thank you in advance,
    Gilbert `

The topic ‘How to use query_posts filter ?’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [gilbert-tordeur](https://wordpress.org/support/users/gilbert-tordeur/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/how-to-use-query_posts-filter/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
