I managed to resolve this issue by using pre_get_posts function and adding the custom post type to the main query.
I added the below to my functions.php file and now I get results for authors in my custom post type:
/* pre_get_posts function added to include post type blog in author loop */
function add_cpt_author( $query ) {
if ( !is_admin() && $query->is_author() && $query->is_main_query() ) {
$query->set( 'post_type', array('post', 'blog' ) );
}
}
add_action( 'pre_get_posts', 'add_cpt_author' );
Related Posts:
- Display Authors Comments on Profile Page
- Author archive only for custom post type
- Get the terms of a custom taxonomy for a specific author in author template
- How can I show a custom post type for users in the authors.php file?
- Author template – separate custom post type by custom taxonomy term for $curauth
- Getting a list of custom posts by author
- the_author_posts_link() for authors of custom post types
- Creating a custom public user page
- Adding %author% in custom post type URL structure?
- Custom loop for custom post type for current author
- Show Custom Post Type by Author
- Refine custom posts by author
- Recent comments on author page?
- Prevent author role from editing all posts in custom post type?
- Display only custom post type count for current author on the “At a Glance” dashboard widget
- How to fetch custom post by Author?
- WP-Admin edit.php & post.php slowdown after import of 10k users
- Check if author or current user has posts published
- Get Author for Single Post in Custom Post Type
- How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?
- WordPress post count not showing for custom post type author
- How Can I Set the Post Author of a Post I Just Created With PHP?
- Custom Post Type and Labels
- Filter post by current 2 differents users id
- How to only show posts assigned to current user, only in certain post types
- get_attached_media() on author page not working
- Permit users with author role to edit a custom post type
- URL rewrite add author as base
- create a new page from a custom post type similar to an authors page
- Edit the author of custom post type
- Can multiple authors be assigned on a single custom post?
- How to restrict author to only access one custom post type ?
- How to show featured image block in custom post type for Author?
- Refine custom posts by author
- Display custom post type posts first, then default posts
- Display an authors post on a single page only when they are logged in
- Select other roles as custom post authors
- post body class for current user only if they are the post author
- Restrict category access to specific users/groups. Author always has access
- Find custom post type url by author
- Display latest posts of author in a custom post type
- Custom post type title of each author in his own post
- get post count for related author
- Display author box on just certain category posts?
- Display custom post counts for author , not default posts
- How do I enforce a specific custom post type on the loop
- Use Author Ids or Names to echo different output inside loop
- Creating an option for writing a post without an author attribution for a group blog on WordPress
- Showing only posts from the current user who is logged in?
- “Author” custom post type
- how to display author name in custom post type
- Limit custom post type to the authors only on front-end!
- How do I get all authors posts of a custom post type outside loop
- Why is wp_list_authors not picking up Authors from CPT’s?
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- Delete Post by User
- How to make id user can be view content
- Display posts on parent post if author coincides
- Author archive custom posts only?
- Set a static page as a user profile page?
- I want to link an author to everything from any post type that they publish on the website
- Display content based on Author Custom Post type
- Get author image for posts in loop on custom type posts page
- WordPress Author Posts Review After Every Change In The Same WordPress Post
- Custom Post Type Author Array Problem
- Show a custom field instead of username in the backend author area
- Custom Post Type supports author
- Author.php not displaying post type posts
- How is get_the_author connected to a custom post type?
- How to display Author Profile based on Custom field value
- how to show Author post type count
- Emailing Authors only when a CUSTOM POST TYPE post is published- not when edited later [duplicate]
- How to get all taxonomies of a post type?
- Can I have Post Types under other Post Types in Admin menu?
- Extend walker class with custom post types [closed]
- Custom post types and permalinks : What a mess !
- Building an Advanced Search (text, tags, category, custom fields) – Getting the wrong SQL query
- Custom post type history
- Query Custom Post Types by date (custom field) range
- Problem with custom post types, taxonomy and permalinks
- Custom post type table
- Modify action buttons for custom post type
- Remove visibility for custom post type
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- How to display Related Posts based on number of taxonomy terms matched
- post_parent in custom post type
- How do I add custom HTML to the content of an archive page’s posts?
- How to add query args to links to CPT admin submenu
- Templates for hierarchical custom post type
- Get post content from another section in custom single page
- List child categories from parent category on custom taxonomy page
- Custom post type – change name in sidebar
- custom post type: own database table structure and custom “new-post” interface
- Modify the category post counting function
- How to create new permission for custom post types for doing specific tasks
- Post navigation doesn’t show (in custom template, custom post type, custom query)
- Hierarchical taxonomy in permalink structure
- Working with gallery shortcode and get gallery images
- Pagination with Custom Post Type
- WordPress Loop trouble with ACF [closed]