Custom Post Type feed to main RSS
-
Hi! I use this code to create a feed for my custom post type. It works fine. I want to add my CPT feed to the main RSS feed. How can I tweak the code to do this?
Thank you!
Caroline
function my_cptui_add_post_types_to_rss( $query ) {
// We do not want unintended consequences.
if ( ! $query->is_feed() ) {
return;
}// Replace these slugs with the post types you want to include.
$cptui_post_types = array(‘produkt’);$query->set(
‘post_type’,
array_merge(
array( ‘post’ ),
$cptui_post_types
)
);
}
add_filter( ‘pre_get_posts’, ‘my_cptui_add_post_types_to_rss’ );
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom Post Type feed to main RSS’ is closed to new replies.