The arguments for get_adjacent_post is not formatted correctly. $excluded_terms needs to be either a string or an array. Also be careful with the category. If ‘portcats’ is a category name and not a taxonomy, that won’t work. This is looking for posts that are in the same ‘portcats’ taxomony with certain terms in ‘portcats’ excluded. The same category is provided by the first(if in multiple) category the current post is in.
$excluded_terms (array or string) (optional) Array or comma-separated
list of excluded term IDs.
<?php $prev_post = get_adjacent_post( true, '18,20,10,21,19,22,17', true, 'portcats' ); ?>
Related Posts:
- How to get next and previous post links, alphabetically by title, across post types, in a shortcode
- Filter get_adjacent_post() for private posts, how to modify JOIN/WHERE?
- Thumbnail (featured image) of next and previous post is not being properly displayed!
- Next/Previous Posts Links: Alphabetically and from Same Category
- Why is previous_post_link and next_post_link working outside of the Loop?
- Next and previous link in custom post type in the same taxonomy term
- Disable “previous link” in first post and “next link” in last post
- excluded_categories parameter in next_post_link() behaving unexpectedly
- Next and prev. post link ONLY within category
- Previous/Next Post Within the Category?
- How to show link to next posts in single.php
- previous_post_link() next_post_link() arrow position
- WordPress “Next Post” URL and Thumbnail
- Add #anchor to next/previous_post_link
- Check if next post is available and output a link
- get rid of the arrow in previous_post_link?
- Change OR logic of get_adjacent_post into AND
- Using ‘previous_post_link()’ & ‘next_post_link()’ on single attachment pages
- get_next_post_link() and get_previous_post_link() return wrong posts
- WordPress next/prev links Issue
- Single: Prev and next Post in same order as main query, in all categories
- Get previous/next post from (specific) category
- altering %title
- Include scheduled ( future ) posts in WordPress post navigation ( previous_post_link, next_post_link )
- Trying to get_adjacent_post – in same category not working
- next/previous post links for specific category when post belongs to multiple categories
- Show category in Previous/Next links
- make random internal linking in the middle of posting
- Why is one of my posts prefixed with “Next Post” on Google search
- How to Navigate within Category? Lot of codes here on stackexchange didn’t work
- Next and Prev post link breaks code on last post
- Multiple next / previous
- Single post navigation Previous post link shows up but Next post link doesn’t
- how to add previous and next link for the posts?
- Next/previous post link to posts only within one or more specific categories
- How to add thumbnail support to WordPress next / previous post loop?
- Get Previous & Next posts by Post ID
- Filter next_post_link() and previous_post_link() by meta_key?
- How can I add title attributes to next and previous post link functions?
- How can I get next/ previous post links to order by a filter (by the last word of the title)?
- next and previous post link ordered alphabetically
- How to show next Post Thumbnail image in WordPress using current post id
- The next_posts_link() show me a aditional page in blank
- next_posts_link not working in custom loop
- Making next_posts_link(); return posts by month
- WordPress previous_post_link exclude posts with multiple categories
- Showing Thumbnail from Previous and Next Posts
- Next and Previous links on a single taxonomy page only link to same term
- connect last post with first post
- How do I insert CSS into a function?
- “next_posts_link” and “previous_posts_link” display me NOTHING
- Can I use get_adjacent_post for specific categories?
- Is it possible to nest get_previous_post()?
- Is it possible to skip certain specified pages when using < prev and next > links?
- Get Prevous/Next Post Specific Category Without Excludes
- previous/next_post_link in the same sub-category?
- posts_nav_link(); picks up index.php instead of category.php as template
- Next Posts Prev Posts for Standard post format only
- get_adjacent_post – in same term or category not working
- previous_posts_link and next_posts_link, how to return the next/previous post’s title as the url
- next_post_link / previous_post_link not working with WP_Query
- Blog home page has canonical link that is incorrect. Do not see where to change this
- Displaying the author of next and previous posts in pagination?
- Single.php Category Post Count
- Why are previous_post_link/next_post_link skipping some posts?
- WordPress post pagination continuous [duplicate]
- WordPress post next/prev not working
- Tweak next_post_link for it to include thumbnail
- Show next post in same category but start from the latest
- Custom Posts and Posts – next_post_link and previous_post_link not working together
- using images in next/previous_post_link [closed]
- Next Prev Post link rendering current post thumbnail
- grab neighboring content in a query
- WP_Query and pagination AGAIN?
- Next/Previous Product with custom order by price & products inside the product category [closed]
- 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?
- CPT : Next or Previous term link when has not adjacent post
- Order by post_date does not work in Previous and Next post pagination
- Infinite next / prev post in single.php page
- WordPress Frontend Page using Plugin
- How to exclude posts by meta key value in the_post_navigation next prev links?
- Infinite looping next post link within a certain category on a post
- Why next_posts(); function does not work inside header.php?
- Using previous_post_link next_post_link but with a filter on a custom field
- how to overwrite next_post_link
- Previous/Next custom post links within custom taxonomy
- How to know if the most recent article
- How do I modify the Previous and Next Page posts on blog pages to include “previous” and “next” before the links?
- Conditionally (cpt) filter previous and next_post_link
- Next/Previous Post Links in single-[custom-post-type].php file
- Next/Previous links in custom taxonomy, where item may belong to multiple terms
- Next page link via the custom menu
- using next-page and previous page inside a wp_query
- Trying to display next and previous set of posts on separate page (not parent page)
- Change next_post and previous_link to navigate throught parent categories only
- pagination/prev and next page links not showing
- Exactly where I have to insert get_next_post_link() in a post?
- Retrieving next_post_link() and previous_post_link() in functions.php
- Next Post Link not working with parameters to restrict to same term
- how to implement next/prev within category archive?