Pagination on category pages using wp_pagenavi causes 404 errors

function category_set_post_types( $query ){
    if( $query->is_category ):
        $query->set( 'post_type', 'any' );
    endif;
    return $query;
}
add_action( 'pre_get_posts', 'category_set_post_types' );

This worked!

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)