Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Add products or other post types to the RSS feed

Your main RSS feed includes the post types you choose (for example WooCommerce products) as well as posts.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category RSS feeds
  • Tested with WordPress 7.1

Before you switch it on: List the post types you want in array( 'post', 'product' ).

It arrives switched off, even when you install its whole pack with "Switch on after installing".

PHP
<?php

add_action(
	'pre_get_posts',
	static function ( $query ) {
		if ( $query->is_main_query() && $query->is_feed() && ! $query->get( 'post_type' ) ) {
			$query->set( 'post_type', array( 'post', 'product' ) );
		}
	}
);

In these packs

  • RSS feeds: Control what your RSS feed shows, and when.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.