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:
- Adding content to archive and taxonomy pages on custom post types?
- Permalink Structure for Multiple Post Type Archives by Taxonomy
- 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
- 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
- Custom Post Type Archive Page: Set Posts Per Page, Paginate
- 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
- 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?
- Display all custom post types in archives.php
- How to Add Pages Under Custom Post Type URL Structure?
- Custom Post Type Archives by Date (stored as meta value) WP3.1
- paginate function in archive for custom-post-type
- Include Custom Posts Type in Year/Month/Date Archive
- where can I see my custom post type archive template?
- Call different archive page based on post type
- How to create archive page for taxonomy terms within custom post type
- 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 list custom post types?
- WP-Admin edit.php & post.php slowdown after import of 10k users
- Custom Post Types and archives
- Display CPT description on archive.php pages for all CPT
- 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 to get “custom post type”-archive with working permalink to it?
- Filter post by current 2 differents users id
- Custom template page with custom archives listing by user
- Changing number of posts per page on CPT-archive.php, have tried 20-30 code chunks so far
- Custom Post Type Archive Page Filtering
- Root slug of taxonomy returning 404
- How to modify archive query with pre_get_posts to append CPTs?
- URL of a custom post type’s post format archive?
- Change CPT archive title
- Edit the author of custom post type
- The loop seems stuck to a single (now deleted) post
- Use “archive” as slug for custom post type
- Is it better to use filter for the_content in archive pages?
- How can I get this request to use the Custom Post Type page template instead?
- Custom post type posts don’t show in archive widget
- Archive for a Taxonomy of a Custom Post type
- Problems with 404, .htaccess, permalinks and WordPress custom posts locally on Snow Leopard
- What’s the name of the custom post type yearly archive template?
- Author posts not appearing for custom post type
- How can I use archive-{post_type}.php theme template?
- Taxonomy archive 404ing (not term archive)
- Display an authors post on a single page only when they are logged in
- Return the name of the post type
- Custom taxonomy or custom page templates?
- archive as a page, so that it can be added in the wp_menu_nav
- Can anyone clarify difference between archive-{posttype}.php, type-{posttype} and date.php?
- Use the custom post type archive for taxonomies?
- Custom Post Type setup
- Restrict category access to specific users/groups. Author always has access
- Dynamic category name in query post
- Custom Post Type Archive Pagination
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Archive Template being used instead of Category Template for Custom Post Type
- get post count for related author
- pre_get_posts works in post type archive but not in single post
- Menu’s breaking, now showing all page links on site
- How can I allow users to edit text that will be displayed on a custom post type archive page?
- How can I increase the post count for custom post types only?
- How can I tell if I’m on a custom post type archive page?
- Is possible register two archive pages for single custom post type?
- users post count
- Custom Post Type Archive Page showing as 404
- Limit custom post type to the authors only on front-end!
- Custom Post Type archive page listing a 404 or single post
- Custom post type pagination problem – page 1 and 2 show same content
- The page or ad listing you are trying to reach no longer exists or has expired
- One of my headings is mysteriously coming up as a link in my CPT Archive
- I broke it! Custom post type archive gets redirected to home
- Custom Post Type tag taxonomy “Page Not Found”
- Custom nav menu current item custom link problem
- Stop Custom post type from being searched via URL
- archive-{custom_post_type}.php not getting recognized wordpress
- Archive.php is not displaying tags
- Custom post type category page not working
- Custom Post Types Archives and daily/monthly joke
- Custom Post Type supports author
- Categories in custom post types
- Display results from two Custom Post Types in page template
- How to make a list of posts displaying them 5 by 5 with a “next posts” link?
- 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
- 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?
- WordPress CPT archive page display sticky post first and then display the rest of the posts in same Query