Skip Navigation

[Resolved] Conditional not work after redirect page [con't]

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 17 replies, has 2 voices.

Last updated by Luo Yang 3 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2057693

As I mentioned above, in your case, it needs to disable home page cache in client's browser, I have done below modifications in your website, edit your theme file "functions.php":
hidden link
in the bottom, add below lines:

function hook_head() {
	if(is_page(23)){
		header('Cache-Control: private, max-age=1');
	}
}
add_filter('template_redirect', 'hook_head', 999);

Please test again, check if it is fixed, thanks

#2058289

Dear Luo Yang,

The issue has been fixed but I still don't understand why only the home page has such an issue. Do I need to add the hook for the page if using wpv-conditional or Toolset has its own setting to manage?

Best regards,

Kelvin

#2059143

[wpv-conditional]是WordPress簡碼,必須要在服務器端執行,這個帖子的問題在於:用戶返回網站首頁的時候,是讀取瀏覽器的緩存,并沒用對服務器端發送請求,所以需要把首頁緩存關閉。希望這個解釋夠清楚了