您可以这样做:
//add reff to query vars to hold the referring page ID
add_filter(\'query_vars\', \'my_query_vars\');
function my_query_vars($vars) {
// add movies_view to the valid list of variables
$new_vars = array(\'reff\');
$vars = $new_vars + $vars;
return $vars;
}
然后添加
?reff=<?php echo $post->ID; ?>
至“帖子详情”链接
在“post detail.php”上,可以使用该查询变量创建一个反向链接
<a href="<?php echo get_permalink(get_query_var(\'reff\')); ?>">Go Back</a>
至于有几个帖子页面,请看一下:
How to quickly switch custom post type singular template