Author archive custom posts only?

You want to only query posts from the post-type direct_blog, but NOT the normal post type?

Than you simply need to remove post from this line:

$query->set('post_type', array('post', 'direct_blog'));

Update:

I just tested the following code.

First you need to revisit your function, as you have some errors in it.
In the code in your question, you are missing a closing }!
Than you are also using posts_per_page, but you are missing the “s“, in your function it is post_per_page.

So I believe you want something like this:

function my_pre_get_posts( $query ) {

    if (!is_admin() && $query->is_main_query()) {

        if ($query->is_author()) {

            $query->set( 'post_type', array( 'my_type' ));
            $query->set( 'posts_per_page', 5 );

        }
    }
}
add_action( 'pre_get_posts', 'my_pre_get_posts' );

As I said above, this code is working in my WP testsite, Iam not seeing normal posts, just posts from my_type in my author archiv template.
So try to change my_type to your post type (make sure that direct_blog is the right slug)

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