当前位置: 代码迷 >> 综合 >> wordpress中如何将新建页面指向自定义的url
  详细解决方案

wordpress中如何将新建页面指向自定义的url

热度:48   发布时间:2024-03-09 08:08:04.0

 自定义模板文件:

当前主题文件夹下,新建一个php文件,名字自定义,如:redirect.php

<?php /*Template Name: Redirect*/if(have_posts()) {
the_post();
#新界面打开
#echo "<script>window.open('" . get_the_excerpt() . "');</script>";
echo header("Location:". get_the_excerpt());
}
?>

进入wp后台

  页面——新建页面——内容中直接写url——模板 选择上一步创建的Redirect

  相关解决方案