[wp-hackers] Caching only admins

Ben May bmay at alyte.com.au
Thu Sep 13 22:13:20 UTC 2012

You could use Mark Jaquith's fragment caching

Then you could do something like this on single for example:

if ( !current_user_can( 'manage_options' ) )
	$single_standard = new CWS_Fragment_Cache( 'single-standard-' .
$post->ID, 300 );

/// other code follows

So that caches for everyone except admins

This MAY help.. depending on what you're wanting to do exactly

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of William P.
Sent: Friday, 14 September 2012 5:01 AM
To: wp-hackers at lists.automattic.com
Subject: [wp-hackers] Caching only admins

I'm wondering if anybody has come up with any creative ways to cache only
a subset of logged-in users. For example, the website I work on has many
many subscribers who are frequently logged in but don't need to see any
uncached content. I'd like to cache all of them, but all the caching
plugins I've seen checked for the existence of the WordPress login cookie
- I don't see any way to cache based on user status. Any ideas, besides
setting an extra cookie at logon?

wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list