The correct method of doing this since WordPress 4.4 is simply the following:
add_filter( "get_next_post_where", function($where, $in_same_term, $excluded_terms, $taxonomy, $post){
$where .= " AND p.post_author="".$post->post_author.""";
return $where;
}, 10, 5);
add_filter( "get_previous_post_where", function($where, $in_same_term, $excluded_terms, $taxonomy, $post){
$where .= " AND p.post_author="".$post->post_author.""";
return $where;
}, 10, 5);
Note: Please do not follow levidia1221’s accepted response, as it involves modifying WordPress Core, which is a terrible idea. Modifying the core means you can’t update WordPress without losing your changes, which is an enormous security risk. If there are no hooks present in a function you want to modify, it’s better to copy the functions you need and change them in your theme or plugin, rather than modifying the core files directly.
Related Posts:
- Problem excluding category from get_next_post
- Custom Posts and Posts – next_post_link and previous_post_link not working together
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- Filter next_post_link() and previous_post_link() by meta_key?
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- How can I get next post id after current post id for custom post type
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Using previous_post_link and next_post_link to wrap around post sequence
- Working with Next and Prev links in Single Taxonomy Templates
- Make `previous_post_link()` Function Show The Post After Next i.e. Jump A Post
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- Next and Previous Posts of Same Parent
- Why are previous_post_link/next_post_link skipping some posts?
- Add Previous/Next Buttons to CPT Single Pages Only
- Display next 3 posts based on custom taxonomy
- Include “Scheduled” (“Future”) Posts in WordPress Post Navigation ( previous_post_link, next_post_link ) for a Specific Custom Post Type
- How to get next post link of child custom post type from parent post and get next post link of parent post from the last child post?
- Prev/Next Navigation on Single Post Disappeared for Custom Post Type
- Back, Next, and Previous links for the REFERRING term archive
- get_previous_post_link and get_next_post_link of custom post type that share custom field value
- Previous/Next custom post links within custom taxonomy
- Next/Previous Post Links in single-[custom-post-type].php file
- show previous/next post orderer by title in custom post types
- previous_posts_link returns null when querying custom post type
- Get the ID of the latest post
- Change permalinks for posts but not for custom post types
- Front end post editing using a form
- Set posts of a custom post type to be private by default?
- How make get_next_post() return first post when viewing last one
- modify all posts of a category to “no comments allowed”
- Getting a div content of a post in wordpress?
- How can I add dropdown widget/box to admin post page?
- Custom permalinks – post type – hierarchical taxonomy’s
- How to show related posts by category or custom post type?
- ascending order custom post type
- add_meta_box: Datepicker like the one for postdate?
- [Plugin: Posts 2 Posts] Changing display order of connections
- Display taxonomy term only if there’s a value
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- How to show post title outside of loop? [closed]
- How do you use JavaScript to detect the homepage
- How to delete all posts from a custom post type?
- Update content of multiple pages/posts at once?
- Get attachment next and previous by author only
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- CPT’s archive and single page not working [closed]
- Trying to edit the single page from a Custom Post
- How to Submit Post Via cURL & PHP
- apply filters only to specific post listing without check the url parameters
- WordPress Orderby Numeric Value Not Working
- is there a way to retrieve posts that do not have a featured image assigned?
- Post image in WordPress not appearing on home page
- How to sort posts in a custom post type by title in ascending order by default?
- Conditional for a Single Post That Belongs to a Category?
- $post not working working in AJAX plugin with custom post type
- Create new custom post and post category of same name
- Load Next WordPress Posts With AJAX?
- If there is only one post (show elements) else (show other elements)
- Custom post type menu
- Modify Posts from Custom_Post_Type within the plugin
- WordPress post next/prev not working
- How do I edit the WordPress post.php file?
- Posts are not rendering perfectly [closed]
- How I can made a custom post type to page templates?
- List all posts in taxonomy term
- list posts of two post types in a single template
- how to redirect to a custom post template
- Post/Custom Post Type URL Access
- Adding /blog in front of single posts (only)
- list articles in admin showing nested categories or slugs?
- Search CPT by tag ids
- Post template with breadcrumb needs to show page navigated from
- Define multiple prefixes for custom post type
- Publishing failed. The response is not a valid JSON response
- add all blog posts to folder
- Correct way adding External classes to Custom Post type and output their methods to template
- Show posts from WP Custom Post Type selected from a field in a metabox
- order custom post type posts by custom date
- How to show posts of the same category on a page?
- custom post type to post association in wordpress
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- How to get all posts related to a taxonomy?
- call a function when insert and update a custom post type
- Work and Display a Custom Post Type as a normal Post
- Most efficient way of showing children posts?
- Custom post type with two templates
- One Post with different content, depending on a Page
- Custom Post Type
- Popup panel is only displaying 1 entry ignoring all others
- Custom Post Status & Taxonomies
- How to display data with pagaination on backend?
- Edit post meta direct from post.php?
- How to Arrange Support => Thumbnail
- Front-end form submission not creating post
- Post being scheduled that shouldnt be schedulded
- Get custom post type parent category
- How to delete unnecessary custom post types in the UI
- show the most recent date of all posts to display on front end
- Error 403 when posting comments to a custom post type from a different page
- Two pagination in one page without AJAX