Category / Custom Post Type permalink issue

A few issues-

  • there is no %book_type% rewrite tag, your rewrite tags are %book% and %chapter%. Change all instances of %book_type% to %book%.

  • Your taxonomy slug should just be 'rewrite' => array( 'slug' => 'books'), the rewrite tag shouldn’t be in there.

  • Last (minor) issue- In your post_type_link filter, you should wrap the fetching of the book term in an if check so you only try to replace the tag if a term is selected. otherwise, with debugging enabled you’ll see a trying to get property of non-object notice from trying to get the slug of a non-existent term.

    if( $book_type_term = wp_get_object_terms( $post->ID, 'book' ) )
        $post_link = str_replace( '%book%', array_pop( $book_type_term )->slug, $post_link );
    

tested and working in twentythirteen theme- visit your permalinks settings page after making changes, to flush rewrite rules, and all should work as expected.