使用此代码未显示前一个 post ID

Previous post id not showing using this code

尝试使用此代码获取以前的 post ID,但它只显示当前的 post ID

$prev_post = get_adjacent_post(false, '', true);
if(!empty($prev_post)) {

$xx = get_the_ID($prev_post->ID);
$yy = get_the_ID($post->ID);
echo $xx;
echo $yy;

请试一试:

$prev_post = get_adjacent_post(false, '', true); 
echo $prev_post->ID;