You can use the combination of in_same_term
and excluded_terms
. First of all, you have the ID of the category you want to display post from. Next, get all the id of the category of the post by using wp_get_post_terms
You can iterate through the returned terms and build an array of terms that you want to exclude. That should do the trick.
Related Posts:
- Getting the Next and Previous Posts Titles in the Sidebar?
- the_post_navigation seems to ignore same category filter
- Adding Post Counts to Menu (Nav) Programmatically?
- Navigation link to specific user page
- Post Navigation
- Restrict post navigation to current sub menu
- get_next_post() and get_previous_post() return wrong posts
- Disable most recent & view all (TABS) on nav-menu.php
- Is it possible to create a form post wordpress custom navigation link?
- remove older posts link [closed]
- How to create a submenu that will navigate through different posts in the same page
- How to Next and Prevous Navigation Buttons on the end of the page with custom image Using Wp Post Navigation Plugin
- How to Restrict Previous & Next Post Link to Posts of Same Category?
- One menu for frontpage (one pager), and a different menu for posts
- Show only one page link in content pagination
- Highlight static blog page link in header
- Show posts count for Categories and Tags in wp_nav_menu
- Restrict the_post-navigation to same category?
- Navigate through the posts using keyboard arrows
- WordPress pagination and Post Navigation not working on home page
- Get current post’s nav menu name (term name)
- Add Text Domain To Post Navigation
- How to show next/prev link, when it’s not active?
- Possible?! A contextually titled back link
- Post navigation using date
- Blog posts pagination not working
- Change URL of previous posts and next posts link in WordPress
- get_next_post() not working with future post status
- Excluding category from post navigation in WordPress?
- Creating a link to the first post in a category
- How to add navigation arrows to manually slide through posts?
- Can the_post_navigation() be outside of the loop?
- Output wp_link_pages as raw url
- Page and Posts loading as index page? Not loading the content
- Count > 1 Navigation Slider
- How do I paginate posts page with $wpdb?
- ‘get_previous_post’ in same category returning (!empty) when no previous post in category exists
- How can I get the first post THIS SAME CATEGORY?
- Show a page counter for pagination
- How can I merge a several related posts into one post?
- Is it possible to Schedule Attachments in WordPress?
- Allow variable amount of comments before pagination
- Check if post has children or not
- Create custom page in WooCommerce
- Duplicate posts
- post_parent is 0 when uploading new files
- Redirection to taxonomy posts list after post submit.
- Frontend Post Excerpt field mapping
- Divide Loop Into Days & Categories
- WordPress – Hide posts in admin from user who did not write them
- How to display different number of posts
- What part of template to edit to remove category name from the top of posts?
- Register post status, exclude from searches
- Ajax Dynamic Archives not showing correct results
- Load post attached images on a single page site with fancybox
- Non-existant URL redirects to existant one
- Exclude the first ‘n’ number of posts of a tag from home page?
- how to show single post in a custom template
- What do comments with […] mean?
- How to add category post count in main navigation menu [closed]
- Remove current category from post but display all others
- How to get links to the last N posts in a specific category?
- wp_update_post question on array
- Why won’t pagination work?
- Single post page breaks when post is more than 30,000 words
- Front end post submission form with duplicate type fields
- How do I include the category next to the title of a post?
- Posts and Pages: 404 Page not found
- WordPress post next/prev not working
- Are post, page and category IDs unique to each other?
- Author Avatar as default first image
- changing parent_id on post
- How to display list of results
- Some blog posts containing source code fail to save draft or publish
- Cannot publish posts, but can create new pages
- Making a new post visible on a specific page
- Custom Fields – How to get the list of a specific active widget each time it rendered
- Problem paginating a subquery on a post
- How to setup default value of post_id
- Google indexing duplicate page content with Page #### in post title and /page-2 in permalink instead of the ones I set
- Display post by Random Authors on Page Refresh
- Trigger on DB make problem on wordpress?
- How to show WP admin edit page within template page/post?
- Loop and output 4 rows of posts on home page
- Bulk Post update_post_meta
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Hiding the name of the user who is currently editing
- Random order of the 5 most popular posts
- List posts of assigned categories in list of all categories on single.php
- Display result of custom form
- How can I choose and change a post title at random from an array when it is published?
- How to show the posts list into a static page? Problems to use the loop into a static page
- Displaying Results From Custom Taxonomy Query
- new blog post does not appear in blog after publishing
- wordpress taxonomy results
- Custom post page has attributes of latest post [closed]
- How to make “my posts” page
- Making a private post visitable by link?
- Display content from specific category
- Batch Scanning and Deleting Empty WordPress Posts