Adding Custom Post Types to the Main Blog Page (ok)

https://kinsta.com/blog/wordpress-custom-post-types/

<?php
function kinsta_books_on_blog_page() {
 
 if ( $query->is_home() && $query->is_main_query() ) {
  $query->set( ‘post_type', array( ‘post’, ‘kinsta_book’ );
 }

}
add_action( 'pre_get_posts', 'kinsta_books_on_blog_page' ); ?>

Last updated