Title: RSS Feed parameters
Last modified: August 21, 2016

---

# RSS Feed parameters

 *  Resolved [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/)
 * Absolutely **love** this plugin. I’m trying to determine how to accomplish the
   following functionality and I’m not sure if its just done through URL params 
   or via a custom RSS feed template.
 * I have a custom post type called “schools” which is CPT-onomies enabled and linked
   to the built in “posts” type. The RSS feed for a particular school should pull
   all posts assigned to that particular post type “school”.
 * Please let me know if you need any additional information regarding the implementation.
 * **Posts on theme template for this school:** [http://thelensnola.org/school/lycee-francais/](http://thelensnola.org/school/lycee-francais/)
 * **Empty RSS feed for this school:** [http://thelensnola.org/school/lycee-francais/feed](http://thelensnola.org/school/lycee-francais/feed)
 * [http://wordpress.org/extend/plugins/cpt-onomies/](http://wordpress.org/extend/plugins/cpt-onomies/)

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/rss-feed-parameters/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/rss-feed-parameters/page/2/?output_format=md)

 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668023)
 * You basically need to hook into the query for the RSS feed so you can add a tax
   query.
 * Add the following action to your code, probably your functions.php:
 * **NOTE: if you print out the query, and you’re not in a development environment,
   then you’ll want to wrap the code in some logic so only you can see what’s happening.**
 * Also, the feed pages are severely cached so you might have to refresh A LOT between
   code changes OR empty your cache every time.
 *     ```
       add_action( 'pre_get_posts', 'my_website_pre_get_posts' );
       function my_website_pre_get_posts( &$query ) {
   
          // There's a 'feed' query variable that lets you
          // know you're running a feed so you can only run
          // your code during a feed.
          if ( $feed = get_query_var( 'feed' ) ) {
   
             // uncomment to print the query so you
             // can see what parameters are set
             /*echo "<pre>";
             print_r( $query );
             echo "</pre>";*/
   
             // You should also have a query variable for
             // 'schools' set to whatever the school name is
             if ( $school = get_query_var( 'schools' ) ) {
   
                // define tax query
                $query->tax_query->queries[] = array(
                   'taxonomy' => 'schools',
                   'terms' => array( $school ),
                   'include_children' => 1,
                   'field' => 'slug',
                   'operator' => 'IN'
                   );
   
             }
   
          }
   
       }
       ```
   
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668028)
 * That makes sense. I’m just not sure where I’m pulling the school slug from. The‘
   schools’ query variable isn’t showing up in the global query object.
 * Do I need to modify the URL or do I need to add rewrite rules to make the query
   recognize the school from the URL?
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668029)
 * How do you have this feed URL work? Did you add_rewrite_rule()?
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668030)
 * I did not. I just added “feed” at the end of the URL to get the post-specific
   feed.
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668031)
 * Can you show me what the $query looks like?
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668032)
 * Something else must be going on, because it appears the query thinks its on the
   products page (we are running the WP e-Commerce plugin).
 * **URL: ** [http://lensnola.staging.wpengine.com/school/lycee-francais/feed/](http://lensnola.staging.wpengine.com/school/lycee-francais/feed/)
 * **Response:**
 *     ```
       WP_Query Object
       (
           [query_vars] => Array
               (
                   [post_status] => publish
                   [post_parent] => 0
                   [order] => ASC
                   [post_type] => wpsc-product
                   [pagename] => products-page
                   [orderby] => ID
                   [error] =>
                   [m] => 0
                   [p] => 0
                   [subpost] =>
                   [subpost_id] =>
                   [attachment] =>
                   [attachment_id] => 0
                   [name] =>
                   [static] =>
                   [page_id] => 0
                   [second] =>
                   [minute] =>
                   [hour] =>
                   [day] => 0
                   [monthnum] => 0
                   [year] => 0
                   [w] => 0
                   [category_name] =>
                   [tag] =>
                   [cat] =>
                   [tag_id] =>
                   [author_name] =>
                   [feed] =>
                   [tb] =>
                   [paged] => 0
                   [comments_popup] =>
                   [meta_key] =>
                   [meta_value] =>
                   [preview] =>
                   [s] =>
                   [sentence] =>
                   [fields] =>
                   [menu_order] =>
                   [category__in] => Array
                       (
                       )
   
                   [category__not_in] => Array
                       (
                       )
   
                   [category__and] => Array
                       (
                       )
   
                   [post__in] => Array
                       (
                       )
   
                   [post__not_in] => Array
                       (
                       )
   
                   [tag__in] => Array
                       (
                       )
   
                   [tag__not_in] => Array
                       (
                       )
   
                   [tag__and] => Array
                       (
                       )
   
                   [tag_slug__in] => Array
                       (
                       )
   
                   [tag_slug__and] => Array
                       (
                       )
   
               )
   
           [tax_query] =>
           [meta_query] =>
           [post_count] => 0
           [current_post] => -1
           [in_the_loop] =>
           [comment_count] => 0
           [current_comment] => -1
           [found_posts] => 0
           [max_num_pages] => 0
           [max_num_comment_pages] => 0
           [is_single] =>
           [is_preview] =>
           [is_page] => 1
           [is_archive] =>
           [is_date] =>
           [is_year] =>
           [is_month] =>
           [is_day] =>
           [is_time] =>
           [is_author] =>
           [is_category] =>
           [is_tag] =>
           [is_tax] =>
           [is_search] =>
           [is_feed] =>
           [is_comment_feed] =>
           [is_trackback] =>
           [is_home] =>
           [is_404] =>
           [is_comments_popup] =>
           [is_paged] =>
           [is_admin] =>
           [is_attachment] =>
           [is_singular] => 1
           [is_robots] =>
           [is_posts_page] =>
           [is_post_type_archive] =>
           [query_vars_hash] => 6c0c4c8bcede69bf39f0c714b5b6a57c
           [query_vars_changed] =>
           [thumbnails_cached] =>
           [query] => Array
               (
                   [post_status] => publish
                   [post_parent] => 0
                   [order] => ASC
                   [post_type] => wpsc-product
                   [pagename] => products-page
                   [orderby] => ID
               )
   
           [queried_object] => WP_Post Object
               (
                   [ID] => 38080
                   [post_author] => 1
                   [post_date] => 2013-03-21 14:47:58
                   [post_date_gmt] => 2013-03-21 19:47:58
                   [post_content] => [productspage]
                   [post_title] => Products Page
                   [post_excerpt] =>
                   [post_status] => publish
                   [comment_status] => closed
                   [ping_status] => closed
                   [post_password] =>
                   [post_name] => products-page
                   [to_ping] =>
                   [pinged] =>
                   [post_modified] => 2013-04-03 10:08:58
                   [post_modified_gmt] => 2013-04-03 15:08:58
                   [post_content_filtered] =>
                   [post_parent] => 0
                   [guid] => http://lensnola.staging.wpengine.com/products-page/
                   [menu_order] => 0
                   [post_type] => page
                   [post_mime_type] =>
                   [comment_count] => 0
                   [filter] => raw
               )
   
           [queried_object_id] => 38080
           [is_product] => 1
       )
       ```
   
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668033)
 * You may have to do add_rewrite_rule() so you can define the parameters.
 * Would probably be something like:
 *     ```
       add_action( 'wp_loaded', 'my_website_rewrite_rules' );
       function my_website_rewrite_rules() {
          add_rewrite_rule( '^school/([^\/]+)/feed/?$','index.php?feed=feed&schools=$matches[1]', 'top' );
       }
       ```
   
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668034)
 * You may have to do add_rewrite_rule() so you can define the parameters.
 * Would probably be something like:
 *     ```
       add_action( 'wp_loaded', 'my_website_rewrite_rules' );
       function my_website_rewrite_rules() {
          add_rewrite_rule( '^school/([^\/]+)/feed/?$','index.php?feed=feed&schools=$matches[1]', 'top' );
       }
       ```
   
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668035)
 * Not sure why WP e-Commerce is messing with the query, but I deactivated it and
   it appears everything is working as expected except the actual feed. If I remove
   my die statement and let the request complete, it redirects back to the school
   page ([lensnola.staging.wpengine.com/school/lycee-francais/](http://lensnola.staging.wpengine.com/school/lycee-francais/)).
 * **Query after my pre_get_posts hook with rewrite rules enabled:**
 *     ```
       WP_Query Object
       (
           [query_vars] => Array
               (
                   [feed] => feed
                   [school] => lycee-francais
                   [post_type] => school
                   [name] => lycee-francais
                   [error] =>
                   [m] => 0
                   [p] => 0
                   [post_parent] =>
                   [subpost] =>
                   [subpost_id] =>
                   [attachment] =>
                   [attachment_id] => 0
                   [static] =>
                   [pagename] =>
                   [page_id] => 0
                   [second] =>
                   [minute] =>
                   [hour] =>
                   [day] => 0
                   [monthnum] => 0
                   [year] => 0
                   [w] => 0
                   [category_name] =>
                   [tag] =>
                   [cat] =>
                   [tag_id] =>
                   [author_name] =>
                   [tb] =>
                   [paged] => 0
                   [comments_popup] =>
                   [meta_key] =>
                   [meta_value] =>
                   [preview] =>
                   [s] =>
                   [sentence] =>
                   [fields] =>
                   [menu_order] =>
                   [category__in] => Array
                       (
                       )
   
                   [category__not_in] => Array
                       (
                       )
   
                   [category__and] => Array
                       (
                       )
   
                   [post__in] => Array
                       (
                       )
   
                   [post__not_in] => Array
                       (
                       )
   
                   [tag__in] => Array
                       (
                       )
   
                   [tag__not_in] => Array
                       (
                       )
   
                   [tag__and] => Array
                       (
                       )
   
                   [tag_slug__in] => Array
                       (
                       )
   
                   [tag_slug__and] => Array
                       (
                       )
   
               )
   
           [tax_query] => stdClass Object
               (
                   [queries] => Array
                       (
                           [0] => Array
                               (
                                   [taxonomy] => school
                                   [terms] => Array
                                       (
                                           [0] => lycee-francais
                                       )
   
                                   [include_children] => 1
                                   [field] => slug
                                   [operator] => IN
                               )
   
                       )
   
               )
   
           [meta_query] =>
           [post_count] => 0
           [current_post] => -1
           [in_the_loop] =>
           [comment_count] => 0
           [current_comment] => -1
           [found_posts] => 0
           [max_num_pages] => 0
           [max_num_comment_pages] => 0
           [is_single] => 1
           [is_preview] =>
           [is_page] =>
           [is_archive] =>
           [is_date] =>
           [is_year] =>
           [is_month] =>
           [is_day] =>
           [is_time] =>
           [is_author] =>
           [is_category] =>
           [is_tag] =>
           [is_tax] =>
           [is_search] =>
           [is_feed] => 1
           [is_comment_feed] => 1
           [is_trackback] =>
           [is_home] =>
           [is_404] =>
           [is_comments_popup] =>
           [is_paged] =>
           [is_admin] =>
           [is_attachment] =>
           [is_singular] => 1
           [is_robots] =>
           [is_posts_page] =>
           [is_post_type_archive] =>
           [query_vars_hash] => 7832e8aa476657087351138dffd158ec
           [query_vars_changed] =>
           [thumbnails_cached] =>
           [query] => Array
               (
                   [feed] => feed
                   [school] => lycee-francais
                   [post_type] => school
                   [name] => lycee-francais
               )
   
       )
       ```
   
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668036)
 * I forgot about the archive thing for CPT-onomies. Try this:
 * and, FYI, you shouldn’t need the ‘pre_get_posts’ action if you’re doing the rewrite
   rule.
 *     ```
       add_action( 'wp_loaded', 'my_website_rewrite_rules' );
       function my_website_rewrite_rules() {
          add_rewrite_rule( '^school/([^\/]+)/feed/?$','index.php?feed=feed&schools=$matches[1]&cpt_onomy_archive=1', 'top' );
       }
       ```
   
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668037)
 * That doesn’t seem to work. I commented out the pre_get_posts hook and [the feed is still empty.](http://http://lensnola.staging.wpengine.com/school/lycee-francais/feed/)
 * **In functions.php (note I uncommented the pre_get_posts to show where I’m printing
   the query; results below)**
 *     ```
       add_action( 'pre_get_posts', 'largo_child_pre_get_posts' );
       function largo_child_pre_get_posts( &$query ) {
   
          if ( $feed = get_query_var( 'feed' ) ) {
   
       	  // uncomment to print the query so you
             // can see what parameters are set
           print_r( $query );
       	  die('testing');
   
             // You should also have a query variable for
             // 'schools' set to whatever the school name is
             if ( $school = get_query_var( 'school' ) ) {
   
             	// define tax query
                $query->tax_query->queries[] = array(
                   'taxonomy' => 'school',
                   'terms' => array( $school ),
                   'include_children' => 1,
                   'field' => 'slug',
                   'operator' => 'IN'
                   );
             }
          }
       }
   
       add_action( 'wp_loaded', 'largo_child_rewrite_rules' );
       function largo_child_rewrite_rules() {
          add_rewrite_rule( '^school/([^\/]+)/feed/?$','index.php?feed=feed&schools=$matches[1]&cpt_onomy_archive=1', 'top' );
       }
       ```
   
 * **Results of print_r (before adding the tax_queries):**
 *     ```
       WP_Query Object
       (
           [query_vars] => Array
               (
                   [feed] => feed
                   [school] => lycee-francais
                   [post_type] => school
                   [name] => lycee-francais
                   [error] =>
                   [m] => 0
                   [p] => 0
                   [post_parent] =>
                   [subpost] =>
                   [subpost_id] =>
                   [attachment] =>
                   [attachment_id] => 0
                   [static] =>
                   [pagename] =>
                   [page_id] => 0
                   [second] =>
                   [minute] =>
                   [hour] =>
                   [day] => 0
                   [monthnum] => 0
                   [year] => 0
                   [w] => 0
                   [category_name] =>
                   [tag] =>
                   [cat] =>
                   [tag_id] =>
                   [author_name] =>
                   [tb] =>
                   [paged] => 0
                   [comments_popup] =>
                   [meta_key] =>
                   [meta_value] =>
                   [preview] =>
                   [s] =>
                   [sentence] =>
                   [fields] =>
                   [menu_order] =>
                   [category__in] => Array
                       (
                       )
   
                   [category__not_in] => Array
                       (
                       )
   
                   [category__and] => Array
                       (
                       )
   
                   [post__in] => Array
                       (
                       )
   
                   [post__not_in] => Array
                       (
                       )
   
                   [tag__in] => Array
                       (
                       )
   
                   [tag__not_in] => Array
                       (
                       )
   
                   [tag__and] => Array
                       (
                       )
   
                   [tag_slug__in] => Array
                       (
                       )
   
                   [tag_slug__and] => Array
                       (
                       )
   
               )
   
           [tax_query] =>
           [meta_query] =>
           [post_count] => 0
           [current_post] => -1
           [in_the_loop] =>
           [comment_count] => 0
           [current_comment] => -1
           [found_posts] => 0
           [max_num_pages] => 0
           [max_num_comment_pages] => 0
           [is_single] => 1
           [is_preview] =>
           [is_page] =>
           [is_archive] =>
           [is_date] =>
           [is_year] =>
           [is_month] =>
           [is_day] =>
           [is_time] =>
           [is_author] =>
           [is_category] =>
           [is_tag] =>
           [is_tax] =>
           [is_search] =>
           [is_feed] => 1
           [is_comment_feed] => 1
           [is_trackback] =>
           [is_home] =>
           [is_404] =>
           [is_comments_popup] =>
           [is_paged] =>
           [is_admin] =>
           [is_attachment] =>
           [is_singular] => 1
           [is_robots] =>
           [is_posts_page] =>
           [is_post_type_archive] =>
           [query_vars_hash] => 7832e8aa476657087351138dffd158ec
           [query_vars_changed] =>
           [thumbnails_cached] =>
           [query] => Array
               (
                   [feed] => feed
                   [school] => lycee-francais
                   [post_type] => school
                   [name] => lycee-francais
               )
   
       )
       testing
       ```
   
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668038)
 * Is the post type called ‘school’ or ‘schools’?
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668039)
 * ‘school’
 * I noticed that too, so I changed the rewrite rule to the following, but it still
   shows up empty.
 *     ```
       add_action( 'wp_loaded', 'largo_child_rewrite_rules' );
       function largo_child_rewrite_rules() {
          add_rewrite_rule( '^school/([^\/]+)/feed/?$','index.php?feed=feed&school=$matches[1]&cpt_onomy_archive=1', 'top' );
       }
       ```
   
 *  [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * (@bamadesigner)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668040)
 * what’s the query after the change?
 *  Thread Starter [Jeff](https://wordpress.org/support/users/jhanbycarrolltongroupcom/)
 * (@jhanbycarrolltongroupcom)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/#post-3668041)
 *     ```
       WP_Query Object
       (
           [query_vars] => Array
               (
                   [feed] => feed
                   [school] => lycee-francais
                   [post_type] => school
                   [name] => lycee-francais
                   [error] =>
                   [m] => 0
                   [p] => 0
                   [post_parent] =>
                   [subpost] =>
                   [subpost_id] =>
                   [attachment] =>
                   [attachment_id] => 0
                   [static] =>
                   [pagename] =>
                   [page_id] => 0
                   [second] =>
                   [minute] =>
                   [hour] =>
                   [day] => 0
                   [monthnum] => 0
                   [year] => 0
                   [w] => 0
                   [category_name] =>
                   [tag] =>
                   [cat] =>
                   [tag_id] =>
                   [author_name] =>
                   [tb] =>
                   [paged] => 0
                   [comments_popup] =>
                   [meta_key] =>
                   [meta_value] =>
                   [preview] =>
                   [s] =>
                   [sentence] =>
                   [fields] =>
                   [menu_order] =>
                   [category__in] => Array
                       (
                       )
   
                   [category__not_in] => Array
                       (
                       )
   
                   [category__and] => Array
                       (
                       )
   
                   [post__in] => Array
                       (
                       )
   
                   [post__not_in] => Array
                       (
                       )
   
                   [tag__in] => Array
                       (
                       )
   
                   [tag__not_in] => Array
                       (
                       )
   
                   [tag__and] => Array
                       (
                       )
   
                   [tag_slug__in] => Array
                       (
                       )
   
                   [tag_slug__and] => Array
                       (
                       )
   
               )
   
           [tax_query] =>
           [meta_query] =>
           [post_count] => 0
           [current_post] => -1
           [in_the_loop] =>
           [comment_count] => 0
           [current_comment] => -1
           [found_posts] => 0
           [max_num_pages] => 0
           [max_num_comment_pages] => 0
           [is_single] => 1
           [is_preview] =>
           [is_page] =>
           [is_archive] =>
           [is_date] =>
           [is_year] =>
           [is_month] =>
           [is_day] =>
           [is_time] =>
           [is_author] =>
           [is_category] =>
           [is_tag] =>
           [is_tax] =>
           [is_search] =>
           [is_feed] => 1
           [is_comment_feed] => 1
           [is_trackback] =>
           [is_home] =>
           [is_404] =>
           [is_comments_popup] =>
           [is_paged] =>
           [is_admin] =>
           [is_attachment] =>
           [is_singular] => 1
           [is_robots] =>
           [is_posts_page] =>
           [is_post_type_archive] =>
           [query_vars_hash] => 7832e8aa476657087351138dffd158ec
           [query_vars_changed] =>
           [thumbnails_cached] =>
           [query] => Array
               (
                   [feed] => feed
                   [school] => lycee-francais
                   [post_type] => school
                   [name] => lycee-francais
               )
   
       )
       testing
       ```
   

Viewing 15 replies - 1 through 15 (of 26 total)

1 [2](https://wordpress.org/support/topic/rss-feed-parameters/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/rss-feed-parameters/page/2/?output_format=md)

The topic ‘RSS Feed parameters’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cpt-onomies_f2f2f2.svg)
 * [CPT-onomies: Using Custom Post Types as Taxonomies](https://wordpress.org/plugins/cpt-onomies/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cpt-onomies/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cpt-onomies/)
 * [Active Topics](https://wordpress.org/support/plugin/cpt-onomies/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cpt-onomies/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cpt-onomies/reviews/)

## Tags

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

 * 26 replies
 * 2 participants
 * Last reply from: [Rachel Cherry](https://wordpress.org/support/users/bamadesigner/)
 * Last activity: [13 years, 1 month ago](https://wordpress.org/support/topic/rss-feed-parameters/page/2/#post-3668068)
 * Status: resolved