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?
- copy wp-include/link-template to child theme
- next_post_link() – how to add url parameter
- Can the Next/Prev Post links be ordered by menu order or by a meta key?
- is it possible to get next_post_link
- 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 to Get Next or Previous Post in a Specific Tag?
- Making a Shortcode [NEXT] and [PREVIOUS] to place into specific posts for post navigation
- get_adjacent_post alternative on a very large db
- Prev/Next child navigation for current page?
- 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 can I limit the length of the previous/next posts in my WordPress Theme?
- How to use next_post_link and previous_post_link on single posts in search results
- How can I get next post id after current post id for custom post type
- Problem excluding category from get_next_post
- How to show next Post Thumbnail image in WordPress using current post id
- adding custom fields to next and previous post link
- 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
- previous / next post with thumbnail
- 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
- Show prev and next post links for parent post of current image in attachment page?
- Custom Taxonomies: Multiple Hierarchical Permailnks For A Single Post + Prev/Next Links
- WordPress previous_post_link exclude posts with multiple categories
- Post in Multiple Categories to stay in current category (permalink, next previous post link)
- Showing Thumbnail from Previous and Next Posts
- get next next post in single.php
- Working with Next and Prev links in Single Taxonomy Templates
- How to make my pagination loop continuously?
- next_post_link and previous_post_link in custom post type single page, in same non-custom category
- Next and Previous links on a single taxonomy page only link to same term
- Get attachment next and previous by author only
- connect last post with first post
- How do I insert CSS into a function?
- “next_posts_link” and “previous_posts_link” display me NOTHING
- next_post_link() on custom menu structure
- Can I use get_adjacent_post for specific categories?
- Next and/or previous post content
- Restrict next_post_link() to current category
- Previous_post and Next_post – Custom Post Type
- next_post_link for CPT only working for a few posts? weird!
- Is it possible to nest get_previous_post()?
- Exclude Posts From Specific Category from Next and Previous post links
- Is it possible to skip certain specified pages when using < prev and next > links?
- Why do next pages load the same content rather then older articles?
- Next and Previous Posts of Same Parent
- Get Prevous/Next Post Specific Category Without Excludes
- Show category from “Next post” and “Previous post” [edited]
- previous/next_post_link in the same sub-category?
- Previous/next post links displaying wrong category than is desired
- 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
- next_post_link and previous_post_link order not working properly
- next/previous links on custom post single a little screwy
- Pass taxanomy parameters to next_post_link()?
- Get Adjacent Post By Tag
- previous_posts_link and next_posts_link, how to return the next/previous post’s title as the url
- Modify previous and next post links to current Authors Other posts
- Link to the next/prev posts in index loop in same category?