将自定义帖子类型添加到主 RSS 源

注册自定义帖子类型并不意味着它会自动添加到主 RSS 源。你需要使用 request 过滤器将自定义帖子类型添加到主 RSS 源。

// Add 'books' custom post types on main RSS feed
function add_book_post_types_to_rss($qv) {
    if (isset($qv['feed']) && !isset($qv['post_type']))
        $qv['post_type'] = array('post', 'books', );
    return $qv;
}
add_filter('request', 'add_book_post_types_to_rss');