基本上我有一个运行下面代码块的函数,该函数接收一个ID,这是我当前发布的帖子。但现在我也需要下一篇文章,但下一篇文章具有相同的元键值。
如何根据我的元键值获取下一篇文章?
$post = get_posts([
'post_type' => $this->post_type,
'post_status' => 'publish',
'orderBy' => 'DESC',
'p' => $id, // This is the current posts ID
'meta_query' => [
[
'key' => 'info-brand',
'compare' => '=',
'value' => Meta::get($id, 'info-brand')
]
]
]);
$nextPost = get_next_post();
td(get_adjacent_post()); // this just dumps the next post in the list of posts and totally disregards my meta query on my post query