LoginSignup
0
0

More than 5 years have passed since last update.

jquery.cookie.jsをWordPressのauthorページで使ったとき、どのページにもキャッシュが反映されてしまう問題

Last updated at Posted at 2016-10-22

やりたかったこと:
WPのauthorページ(ユーザーページ)に、authorの長い紹介を入れていて、その下にauthorが書いた記事を入れているが、2回目以降は紹介を読む必要はないので、Cookieを利用して「続きを読む」ボタンでアコーディオンが閉じた状態にする。

問題:
jquery.cookie.js の pathを "" にしても、現在のauthorのページだけでなく、他のauthorのページを開いたときにも反映されてしまう

解決策:
the_author_meta('ID') で、現在のauthorのIDを取得し、Cookieに入れる

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0