Last active
August 29, 2015 14:08
-
-
Save PurpleHippoDesign/8504c765a6022fe556c5 to your computer and use it in GitHub Desktop.
Add CPT to 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
<?php | |
// Note: Add only code below to your functions.php | |
// Add custom post types - cpt1 and cpt2 to main RSS feed. | |
function mycustomfeed_cpt_feed( $query ) { | |
if ( $query->is_feed() ) | |
$query->set( 'post_type', array( 'post', 'cpt1', 'cpt2' ) ); | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'mycustomfeed_cpt_feed' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment