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

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

```
<?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' ); ?>
```

