Skip to content

Instantly share code, notes, and snippets.

@nickeforsberg
Last active June 8, 2021 09:20
Show Gist options
  • Save nickeforsberg/26de751d08672d0d99e1 to your computer and use it in GitHub Desktop.
Save nickeforsberg/26de751d08672d0d99e1 to your computer and use it in GitHub Desktop.
Multiple Custom Post Types to Wordpress main RSS Feed.
// Add custom post types main RSS feed.
function wp_rss_feed( $query ) {
if ( $query->is_feed() )
$query->set( 'post_type', array( 'post', 'events', 'books' ) );
return $query;
}
add_filter( 'pre_get_posts', 'wp_rss_feed' );
@besweeet
Copy link

Ok. Weird. Do you use public=>true ? And has_archive=>true

I use Pods to create the custom post types and I confirmed that they are set to public and have archives enabled.

@nickeforsberg
Copy link
Author

Ok. Weird. I need to check that up for you.

@besweeet
Copy link

besweeet commented Jun 1, 2021

Any updates? Is there anything related to caching that might be causing a conflict?

@nickeforsberg
Copy link
Author

Hey! Sorry no updates yet! What do you need to do? Can you send me some examples?

@besweeet
Copy link

besweeet commented Jun 1, 2021

I have three custom post types: guides, newsletters, and videos. Goal is to combine them into one feed (the main feed is fine since the default WordPress "post" type will be used for anything).

@nickeforsberg
Copy link
Author

Sorry!! I din't get this to work any more! sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment