To use get_adjacent_post you have exclude all the term id of that specific taxonomy, For polylang your texonomy is language, First you have retrieve all term ids of indivual languages, and then exclude all of them other than the one you want.
global $post;
$post_id = [XXXX]; // any specific post id
$post = get_post($post_id);
//get all the tems of language taxonomy
$terms = get_terms( 'language', array(
'hide_empty' => false,
) );
$excludeds_term_ids = array();
foreach($terms as $term){
if($term->slug !='en'){ // exlude all of them other than 'en'
$excludeds_term_ids[]= $term->term_id;
}
}
$next_post = get_adjacent_post(true,$excludeds_term_ids,false,'language');
echo $next_post->ID;
Related Posts:
- Get Posts Under Custom Taxonomy
- How do I check if I linked to a post before I delete it?
- How to use “Add link” pop up for a WordPress widget
- Different post sort order within different categories
- Displaying the category name of a custom post type
- Elegant way to include only published posts with get_objects_in_term()?
- Portable Post Links
- Show WordPress Custom Taxonomy Items Based On a Selected Item From Another Custom Taxonomy
- WordPress: How to get the current logged in author page URL?
- Exclude posts that only have the ‘Uncategorized’ category [duplicate]
- How are terms connected with posts in database?
- Keep getting same permalink with WP_Query?
- Convert IPTC keywords to blog post tags
- Is it possible to add a first and latest posts link?
- Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX
- Importing data from spreadsheet into wordpress DB, along with custom taxonomies and their terms
- Get current users post URL?
- Navigation link to specific user page
- how to grab first link in post… and of course call it
- Load post content into div with ajax
- wp_list_categories link to first post of category instead of calling taxonomy template
- Link for the page archive for posts, like using custom post types with get_post_type_archive_link
- Linking to page with all posts
- get_terms parent for current product only
- deleting terms programmatically
- Adding Multiple Values to a Post Meta Key
- How do I get the slug of a custom taxonomy category of a post?
- Post taxonomy from exif data
- Redirection to taxonomy posts list after post submit.
- Remove custom posts that match taxonomy value
- Using Custom Posts with Metaboxes and Drop-downs
- Does an action fire when adding a tag via the “Tags” meta box?
- Link button is not working while editing a post in Firefox [closed]
- How can I add a meta-box to the posts editor containing all items of a custom taxonomy as checkbox?
- disable column on post and user list
- Adding a text link under the post title in the lists of posts
- if I create ‘front-page.php’, then how do I link to post index?
- Setting up navigation links for posts (first, prev, next, last)
- Direct link to “New post” in specific category?
- Avoid duplicate post from same Taxonomy
- Automatically Updating Publish Date Bug
- Get posts by name and taxonomy term
- How to display data in archive page?
- Removing rel=”nofollow” from links posted in Post Content
- Delete post by giving its link
- Set terms in a custom post
- How should I add links to other pages/posts from my post?
- Get posts of ONE taxonomy term of custom post type
- Pass data between pages
- Choose whether to automatically add a taxonomy with the same name as the post
- Display tag image in post using Taxonomy Images plugin index.php
- wp_get_object_terms returns only Uncategorized on first publish
- Remove all external links from posts
- Edit post & page option does not display on latest wordpress
- Add data attribute of post_id for Internal links
- Prevent the automatic URL linking added in last update
- WordPress 5: prevent link from displaying page title instead of URL
- Some custom post types did not return an object
- Post not using taxonomy template
- How do I remove all links from all my posts at once?
- Show post count in custom taxonomy page
- Create/Set Category as Title of Post
- Taxonomy checkboxes not showing current status on edit page
- Page with Category Returning 1
- Creating a link to the first post in a category
- Slug collision between page, taxonomy and custom post type
- Customizing URL slugs of Custom Post Type and Taxonomy make posts/pages 404
- Post Category link is same with Page link
- wordpress display posts by terms id or name
- How to get post count including nested categories
- Custom Taxonomy From Database
- Multiple Custom Post Type loop logic
- How to list all names and descriptions of a custom taxonomy
- Post List Widget with custom posts and editing the Read More Link
- How to add a class to links inside posts text
- How to display term in archive page?
- How can add posts without category into category
- Featured Images link to post parent
- 404 for some custom taxonomy not ALL taxonomy
- My posts section for logged in user
- Displaying Results From Custom Taxonomy Query
- External link not showing on post but showing on comment
- Multiple loops on a Search result page?
- How to get all the terms of a post
- How to change link with broken link?
- Modifying the permalink href for posts with jquery
- Special Query: Title, Terms, Content – %LIKE%
- retrieve post slug by post_tags taxonomy
- Automatically add class to link based on link text
- Read more link not working [closed]
- Taxonomy Category category.php not working
- After the local installation of an old WP website I can see the homepage but I can’t access to the articles, why?
- How to make ‘show_option_all’, that comes from wp_list_categoreis, to work with get_categories or with get_terms?
- How to automatically convert a form with HTML link into post
- Automatically search and replace link in content (pages/posts)?
- Filter/Sort Post Form On Taxonomy page
- How to remove category and other tags from posts page
- I want the Title of page/post to show up topmost when reading the post/page
- Permalink issue with new blog posts > getting 301 redirect
- How do I link my post title/excerpt/read more to the source site?