您可以使用cookie 在访问者的浏览器中存储信息。
在单个帖子模板中,可以使用
setcookie( \'last_post_id\', get_the_ID() );
在另一个页面上,您可以管理用户访问的最后一篇文章。
$last_post_id = ! empty( $_COOKIE[\'last_post_id\'] ) ? $_COOKIE[\'last_post_id\'] : false;
if( $last_post_id ) {
// do something with the cookie.
}