簡體   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