Have you read the codex page Author Templates? There it states:
when a viewer clicks on a link to a post author, by default he or she is taken to a page listing the posts from that particular author in chronological order
This depends on having the correct links setup, which can be done with the_author_posts_link()
or wp_list_authors()
. A custom query shouldn’t be necessary, you can alter the post types by hooking into pre_get_posts
.
Code:
function wpse124293_cpts_for_author_archives( $query ) {
if ( ! $query->is_main_query() || is_admin() )
return;
if ( is_author() ) {
//only show cpt audio
$query->set( 'post_type', array( 'audio' ) );
//to show builtin post and cpt audio use: array( 'post', 'audio' )
}
}
add_action( 'pre_get_posts', 'wpse124293_cpts_for_author_archives' );
Related Posts:
- Order by & include array by specific post ids
- Get list of all registered post types slugs
- Getting a list of custom posts by author
- Display Authors Comments on Profile Page
- the_author_posts_link() for authors of custom post types
- Adding %author% in custom post type URL structure?
- Limit the post for differents custom post type in the same wp_query
- array_pop() expects array, boolean given for $event_type_term ->slug
- Author archive only for custom post type
- Custom loop for custom post type for current author
- Show Custom Post Type by Author
- Recent comments on author page?
- Save custom post type in different table
- Get the terms of a custom taxonomy for a specific author in author template
- Prevent author role from editing all posts in custom post type?
- Automatically adding meta data to posts or multiple query help
- 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%?
- How can I show a custom post type for users in the authors.php file?
- 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
- Create a post in custom post type using field in registration form after users submit form
- My theme saves their custom post type’s metadata as a serialized array, how to access the keys?
- Save an array from drop-down in custom meta box
- How to only show posts assigned to current user, only in certain post types
- get_attached_media() on author page not working
- How to store multiple values in 1 meta_key with radio input?
- Display a CPT based on a metabox selection
- Permit users with author role to edit a custom post type
- URL rewrite add author as base
- Edit the author of custom post type
- Display post content with respect to its title?
- Can multiple authors be assigned on a single custom post?
- Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
- How to restrict author to only access one custom post type ?
- How to show featured image block in custom post type for Author?
- Limit the post for differents custom post type in the same wp_query
- Custom Post Types — $args vs. labels array
- Get an array wich contains the post_name of every post that has the custom post_type “pelicula”
- Add first letter of titles to array, then compare arrays
- Author posts not appearing for custom post type
- Query Custom Post Types with checkboxes
- Display an authors post on a single page only when they are logged in
- Create Array from custom post type to display a slider
- Inefficient Query Confusion
- Querying multiple values from a single key
- Check if user has comment on current post
- Select other roles as custom post authors
- post body class for current user only if they are the post author
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- Restrict category access to specific users/groups. Author always has access
- How do I disply an array inside a custom post type?
- Custom Post Type Field Array parsing [closed]
- Getting custom post types to properly display alphabetically
- 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
- 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 can I loop at a Specific Taxonomy from a custom post type?
- Update value inside array update_post_meta
- Custom archive page for custom taxonomy and pagination issue
- Get an array of the number of post per year of a custom post type (WordPress)
- Query when is one or several values
- how to display author name in custom post type
- Limit custom post type to the authors only on front-end!
- Staggering featured post using ‘sticky’
- 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
- If custom taxonomy exist on post?
- 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?
- Convert Custom Post Data to Javascript Array for Autocomplete
- I want to link an author to everything from any post type that they publish on the website
- Get author image for posts in loop on custom type posts page
- Trying to get custom post type attachment images to function in indexed array
- CPT and metabox: create multi checkbox by using array?
- posting twice from an array?
- create functions based on array values
- 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]
- Display custom post type attached media file sizes
- post__in select all custom posts and not the selected array of ids