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
- How to display custom field in product description?
- Right way to store a large set of similar information on website? [duplicate]
- How to display posts with plugin (advanced custom fields) field groups?
- Define multiple prefixes for custom post type
- WordPress – display relationship between blog posts and custom posts
- Create a post automatically if search result has zero results
- Post template not applying on theme (potentially rendering as Page template)
- Publishing failed. The response is not a valid JSON response
- add all blog posts to folder
- How do I find the count of the current post?
- Limiting the Number of User Posts to Their Own Posts
- Custom page with no headers, footers and its own CSS, Javascript
- Correct way adding External classes to Custom Post type and output their methods to template
- Permalink for specific post type
- how to display posts content on the custom css popup by clicking on each title on the sidebar?
- Show custom post status when logged out
- Show posts from WP Custom Post Type selected from a field in a metabox
- wp_post_delete is deleting all offices
- SEARCH QUERIES – REVERSE OUTPUT
- WordPress retrieving $post based on random key in $_POST
- order custom post type posts by custom date
- Is there a way to create a sidebar of bullets
- How do I insert a custom post type query after a certain number of recent posts and then resume recent posts?
- How to show posts of the same category on a page?
- Why doesn’t wp_delete_post allow trashing for custom types?
- Get queried object for custom post type count
- Change URL of previous posts and next posts link in WordPress
- edit.php all post not working
- Assign a Post to a User
- Cannot save pages after migration
- Adding specific custom fields (images) to post excerpt
- Bulk trashing post ‘fails’
- $_POST from a Meta Box
- How to create editable sections in wordpress?
- Instructor can view, edit, delete only theirs courses
- Add input radio menu to post
- How to properly get the wp_postmeta.meta_value of a custom post type in specifics?
- News post with multiple permalinks? When opened from different page
- custom post type to post association in wordpress
- minimize wp_query call to database
- How to add custom PHP code in post header?
- I cannot display custom posts in custom taxonomy
- Post display in separate page [duplicate]
- Rest Api not working with Iframe in form data
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- subtracting the current post form then whole loop, which is generating all CPT titles
- User Archive page for Custom Post Type – Pagination Issue
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- How to manage a dynamic multi-level page hierearchy system?
- Assign for all post of a post type a specific single-post template
- post type => ‘any’ not applied my custom queries
- Custom Post By Category
- Widget area for individual posts (custom post type)?
- How can I get the last 5 element of this tax query?
- Using Orderby and meta_value to order natural/alphanumerical
- Limit posts per page depending on the size of a div?
- Display title of all custom posts from same taxonomy term on a custom post template
- Use WP pagination functions on a custom page template
- Delete Post by User
- Custom post Query and WordPress Post Query Clash
- How to get the posts that my following users are liked?
- How to insert post 6 times after user register like ask.fm
- custum post inner page not taking single-gallery.php? it redirecting to archive page
- Change Custom Post Type to Post + Category
- Event Manager: Events Deleted are still in DB as published but hidden in admin
- How can i order my posts by post type?
- Rewrite url post_tag for custom post type
- Setting up a page to house certain types of posts
- When post is Published, insert into custom table a number – custom post type
- How to get all posts related to a taxonomy?
- previous and next post of same category on singlepost.php
- call a function when insert and update a custom post type
- Multiple Custom Post Type with different Taxonomies
- Creating custom post type relationships
- WP_posts (Not meta) extra custom field column show and change it in a custom post type
- how to make custom post with “publish” default functionality not save in draft?