开发者

Why is it I cant set a get variable

开发者 https://www.devze.com 2023-02-20 04:27 出处:网络
I am appending ?readmore=true to the end of a url in wordpress <a href=\"<?php the_permalink(); ?>?readmore=true\" class=\"readmore\">

I am appending ?readmore=true to the end of a url in wordpress

<a href="<?php the_permalink(); ?>?readmore=true" class="readmore">
  <span><?php _e('Read more','MyProduct'); ?></span>
</a>

but on the next page I tried this

<?php
  print_r($_GET);
  if($_GET['readmore'] == 开发者_JAVA技巧"true") {
  get_header();
  }
?>

and in my print_r

I get this

 Array ( [page_id] => 8?readmore=true ) 

Am I missing something about get variables in wordpress


Try to append &readmore=true instead of ?readmore=true.

0

精彩评论

暂无评论...
验证码 换一张
取 消