繁体   English   中英

WordPress页面重定向到首页

[英]Wordpress page redirect to home

由于代码中的某些问题,我的页面正在重定向到首页。

我有三个链接:

  1. 日内提示( https://www.xyz.in/intraday
  2. 位置提示( https://www.xyz.in/positional
  3. 商品提示( https://www.xyz.in/commodity

第一个链接工作正常,而其他两个链接重定向到首页

最初很好,因为链接后有一个条款页面,如下面的代码所示。

 <?php if(isset($_POST['accepted']) && $_POST['agree'] == 1) { while ( have_posts() ) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_content(); ?> <?php endwhile; ?> <?php } else { ?> <?php query_posts('page_id=182'); while ( have_posts() ) : the_post(); ?> <h2>Terms & Conditions</h1> <?php the_content(); ?> <form method="post" action=""> <p><input type="checkbox" value="1" id="agree" name="agree" style="margin-right: 10px;" /><label for="agree">I accept terms and conditions.</label><input type="submit" id="accepted" name="accepted" class="btn btn-primary btn-sm" value="View Tips" title="Check the box to proceed" style="margin-left:10px;"/></p> </form> <?php endwhile; ?> <?php } ?> 

现在,我修改了代码以绕过中间页“条款和条件”,问题开始了。

  <?php if(isset($_POST['accepted']) && $_POST['agree'] == 1) { while ( have_posts() ) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_content(); ?> <?php endwhile; ?> <?php } else { ?> <?php while ( have_posts() ) : the_post(); ?> <?php the_content(); ?> <?php endwhile; ?> <?php } ?> 

但这仅适用于第一个链接,其他链接正在重定向到主页

抱歉,我遇到了问题..... :-)

在header.php中,有一个代码强制其在某些情况下重定向到主页。

 if(is_page(array(220,221)) && !is_user_logged_in()){ wp_redirect(home_url()); exit(); } 

我只是将其删除,一切正常。

非常感谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM