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?
- Adding content to archive and taxonomy pages on custom post types?
- Filtering a custom post type by custom taxonomy in archive template
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- get term archive url / link
- How to get the custom post type from an archive page?
- How to remove “Archive:” label from archive title
- Why are posts from custom post type not displayed in “category” archive?
- Custom Post Type Archives by Date and Taxonomy
- Displaying category archive of custom post types
- Custom post types – Use post_id in permalink structure when using has_archive => true
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- Getting a list of custom posts by author
- $query->set in pre_get_posts is unintentionally affecting the backend
- Display Authors Comments on Profile Page
- the_author_posts_link() for authors of custom post types
- Pagination throws 404 error on custom taxonomy archive pages
- Setting up custom post type archives in WP3.1? Any luck?
- Proper way of making custom post type landing page or archive page
- How do I display two separate taxonomy archives for two post types that share a single taxonomy?
- Custom Post Type Archives by Date with Custom Permalink
- Filter for “get_post_type_archive_link()”
- How to add meta box to backend menu page
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- Change title in head on Archive page
- Display Editable Text Above CPT Archive Listings
- Custom Post Type Archives with 0 Posts Redirects as 404
- How to show more posts on an archive page?
- Archive page with multiple taxonomies rewrite
- Multiple Paginations on one Page
- Create permalink structure for one taxonomy archive per custom post type
- Archive page…limiting posts per page
- WP 3.1 – archive pages for custom content types possible now without a plugin?
- Page is defaulting to archive page and not designated template
- Adding %author% in custom post type URL structure?
- Date archives for custom post type
- Custom Post Type Archive URL takes over page URL
- Custom comment status possible?
- Author archive only for custom post type
- Better to use a post type archive, page template, or shortcode for generating a highly configurable CPT archive?
- Display all custom post types in archives.php
- Custom loop for custom post type for current author
- How to Add Pages Under Custom Post Type URL Structure?
- Custom Post Type Archives by Date (stored as meta value) WP3.1
- WordPress custom post type category pagination 404 Error
- Custom Permalinks for Custom post Type Archives?
- is_singular won’t call my functions?
- Custom post type archive with pagination?
- Custom post type tag archives don’t work for basic loop?
- Removing CPT slug from URL results in 404 error for archive page
- Multiple post types in archives (filter?)
- Pages, Custom Posts & Custom Taxonomy defining slug structure
- How to show a tag archive of one post type only
- How to let custom post type posts show in standard post archive (like in homepage)?
- Regex problem in an add_rewrite_rule
- paginate function in archive for custom-post-type
- Custom taxonomy archive page not working
- Recent comments on author page?
- Include Custom Posts Type in Year/Month/Date Archive
- Change plugin’s has_archive = true to false?
- where can I see my custom post type archive template?
- wrong template for page of archive
- How to show multiple post types on taxonomy archive?
- Call different archive page based on post type
- Disable single pages and archives and keep preview
- Custom post type archive sorted and grouped by date in post meta field
- Display results from two Custom Post Types in page template
- Taxonomy Query of Custom Post Displays Archive Instead of Posts
- Author template – separate custom post type by custom taxonomy term for $curauth
- Generate daily archive whenever any post type is added
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- Stop header code from showing in category page?
- is_singular won’t call my functions?
- Query Custom Post Type and sort by year
- Custom post types not using archive structure
- How to turn custom-post archive into an overview page, listing the metadata of the posts?
- Pagination not working for archive
- 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?
- 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]
- WP Query + custom fields: How to query event posts from the current date backwards 6 months and organize it month by month?
- Show custom category archive as front page and remove taxonomy slug from urls
- WordPress CPT archive page display sticky post first and then display the rest of the posts in same Query
- Custom Post Type posts not getting picked up in archive widgets
- Remove date rewrite rule for custom post type archive page
- Why using archive pages at all?
- Taxonomy term archive claims there are no posts, but there are. How to resolve?
- A theme has 3 default types posts, services and portfolio in its posts grid.I want to add my custom post type products How can I achieve that?
- Separate archive template to show posts and CPT by same category/taxonomy
- Create an archive page by combining two post type
- author archives, showing all custom post types, problem on pagination
- How do I get an intermediary page between 2 custom post types?
- WordPress Custom Post Type Archive, filter by category and get pagination working
- Custom Taxonomy archive with url parameters