The restrict_manage_posts
hook supplies the current post type as the very first parameter to the callback function (which is book_genre_filter_page()
in your code), so you should use it (instead of the static $type
variable in your code) to determine the current post type or to ensure your custom filter is displayed only on the admin screen for editing posts in your post type:
add_action( 'restrict_manage_posts', 'book_genre_filter_page' );
function book_genre_filter_page( $post_type ) {
if ( 'book' == $post_type ) {
... your code here ...
}
}