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' ); |
Ok. Weird. Do you use public=>true ? And has_archive=>true
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.
Ok. Weird. I need to check that up for you.
Any updates? Is there anything related to caching that might be causing a conflict?
Hey! Sorry no updates yet! What do you need to do? Can you send me some examples?
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).
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
Added this to my theme's functions.php file and the main
/feed/
doesn't show any posts from my custom post types.