zl程序教程

您现在的位置是:首页 >  其他

当前栏目

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

WordPress 如何 自定义 页面 url 新建 指向
2023-09-27 14:27:48 时间

 自定义模板文件:

当前主题文件夹下,新建一个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