I am using the function below to try and display custom post type 'direct_blog posts only. However for some reason it is also displaying standard posts and I don't know why?
Your help is much appreciated. Thanks in advance.
function blogs_custom_author_archives_posts_per_page($query) {
if (!is_admin() && $query->is_main_query()) {
if ($query->is_author()) {
$query->set('post_type', array('direct_blog'));
$query->set('posts_per_page', 5);
}
}
}
add_action('pre_get_posts', 'blogs_custom_author_archives_posts_per_page');