Adding Custom Post Types To Post Feeds

Posted in: Newspaper
Post count: 38

Typically this code will make any posts made under custom post types show up on the home page for a theme

add_filter( ‘pre_get_posts’, ‘pa_add_custom_posts_to_home_and_feed’ );
function pa_add_custom_posts_to_home_and_feed( $query ) {
if (((is_home() || is_tag()) && $query->is_main_query())|| is_feed())
$query->set( ‘post_type’, [‘post’, ‘reviews’, ‘news’, “videos”, “guides”, “faq”]);
return $query;
}

The code is not working for me with this theme. Only the standard posts are showing up in the post feeds. The custom posts are showing up when i view them directly, but i would like them to show up on the main page too.

Is there any work around for this?

Post count: 1291

Hi,

The code has some errors in the syntax(single/double quotes format). Try to fix them and see if it works, if it doesn’t try this solution – http://www.wpbeginner.com/wp-tutorials/how-to-add-custom-post-types-to-your-main-wordpress-rss-feed/

Thank you!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.