You will need to filter ‘author_link’ to conditionally add the parameter that can be used to add the custom post type into the query for the author’s posts.
add_filter( 'author_link', 'myprefix_author_link', 10, 3 );
function myprefix_author_link( $link, $author_id, $author_nicename ) {
if ( is_singular( 'myCPT' ) || is_post_type_archive( 'myCPT' ) ) {
$link = add_query_arg( 'post_type', 'myCPT', $link );
}
return $link;
}
The default (your else clause) will show only posts anyway, so no new code is needed for that.
Related Posts:
- Custom Post Type Archives by Year & Month?
- Get custom post type slug for an archive page
- Custom post type pagination 404 fix?
- How to remove “Archive:” label from archive title
- the_author_posts_link() for authors of custom post types
- Custom Post Type Archives by Date with Custom Permalink
- Change title in head on Archive page
- Display Editable Text Above CPT Archive Listings
- Custom loop for custom post type for current author
- Custom post type archive with pagination?
- Pages, Custom Posts & Custom Taxonomy defining slug structure
- How to show a tag archive of one post type only
- Regex problem in an add_rewrite_rule
- Custom taxonomy archive page not working
- Change plugin’s has_archive = true to false?
- wrong template for page of archive
- How to show multiple post types on taxonomy archive?
- Get the terms of a custom taxonomy for a specific author in author template
- Custom Post Type with static page for archive
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Slug for standard post post_type
- WordPress custom post type archive with description
- CPT: archive-cpt.php VS custom page template
- Get post type from taxonomy or category page
- Category page only displaying the posts from a custom type
- How to fetch custom post by Author?
- custom taxonomy archive by year
- Check if author or current user has posts published
- Display custom post type taxonomies as an archive page
- Change name of custom post type archive
- When ‘is_post_type_archive()’ return true?
- Editable content on a Custom Archive page
- How can I show a custom post type for users in the authors.php file?
- Custom Post Type and Labels
- How to show the archive / post type description on Single templates
- is_main_query() not working for WP REST API
- CPT Archive with core Category
- How to only show posts assigned to current user, only in certain post types
- get the custom post type title/name
- Get archive post type name
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Filtering WP_Query
- Custom post type – get_day_link()
- Why is my site using index.php instead of archive?
- WordPress showing archive.php instead page
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Archive not sorting correctly
- What’s the name of the custom post type yearly archive template?
- multiple custom post type on category page
- Assign CPT archive page attributes
- Custom taxonomy or custom page templates?
- Can anyone clarify difference between archive-{posttype}.php, type-{posttype} and date.php?
- How do I add custom HTML to the content of an archive page’s posts?
- Only show posts with a specific term of an associated taxonomy in a custom post type archive
- Use the custom post type archive for taxonomies?
- Display Date & Author Info on Custom Post Type Archive Page
- How to constrain the results to a specific post_type on tag archive page?
- get post count for related author
- How to prevent a custom post type from using the archive.php template?
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- How can I tell if I’m on a custom post type archive page?
- Showing only posts from the current user who is logged in?
- How to achieve a multi-taxomony layout with posts?
- how to display author name in custom post type
- Limit custom post type to the authors only on front-end!
- Custom Post type page content (archive page)
- Set up Custom Taxonomy Archive Template File To Cover 3 Categories
- Group custom post type posts by month
- Custom WordPress theme not displaying posts from category
- Creating an archive page or simple template to list all values of a custom field of specific post type listing
- Custom post types not showing on the standard WordPress Category page
- Turning archive templates to a page template maintaining the slug
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- Order archive custom posts by taxonomy term [duplicate]
- Custom Archive – hide posts until a search is made?
- How to make id user can be view content
- Display posts on parent post if author coincides
- Set a static page as a user profile page?
- Custom Post Type tag taxonomy “Page Not Found”
- Get author image for posts in loop on custom type posts page
- Custom Post type archives / categories give 404
- Site loads very slow for archive custom post type page
- WordPress Author Posts Review After Every Change In The Same WordPress Post
- Archive.php is not displaying tags
- Custom post type category page not working
- Custom post types with date based archive
- paging is not working properly on news archives page [duplicate]
- Custom Post Type Author Array Problem
- Categories in custom post types
- Author template – separate custom post type by custom taxonomy term for $curauth
- is_singular won’t call my functions?
- How to turn custom-post archive into an overview page, listing the metadata of the posts?
- how to pass args for archive.php query?
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- Remove plugin’s custom post type archive page and single pages [closed]
- How is get_the_author connected to a custom post type?
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- Custom Post Type posts not getting picked up in archive widgets
- Custom Taxonomy archive with url parameters