query_postsを使ったあとは、きちんとリセットしよう

query_posts関数は結構便利なので、どのサイトでも利用させてもらっています。
しかしながら、この関数を使った後は、リセット関数を用意しなければならないことに最近気が付きました。

気がついたきっかけは、query_postsをつかったソートをかけた後は、《comments.php》が表示されなかったこと。
phpの構文エラーかと思いcomments.phpの後ろに適当なテキストを入れて実験。
きちんと表示されるので、おかしいなぁと思い本家を調査。ちゃんと書いてありました。。。

もし、ブログのコメントフォームが表示されなくなったときは、query_posts関数のリセットをチェックしてみてくださいな。
私は、この事に気がつくまで1時間ほど無駄にしました。angry.gif

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny