Last active
June 8, 2021 09:20
-
-
Save nickeforsberg/26de751d08672d0d99e1 to your computer and use it in GitHub Desktop.
Multiple Custom Post Types to Wordpress main RSS Feed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' ); |
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
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).