Advertisement
swte

Prebuild user cache

Aug 11th, 2020 (edited)
1,299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.47 KB | None | 0 0
  1. add_action('swift_performance_prebuild_cache_hit', function(){
  2.     // Get all users here
  3.     foreach (get_users() as $user){
  4.         add_filter('swift_performance_prebuild_headers', function($headers) use ($user){
  5.                 $headers[LOGGED_IN_COOKIE] = wp_generate_auth_cookie($user->id);
  6.                 return $headers;
  7.         });
  8.         Swift_Performance::prebuild_cache_hit($permalink);
  9.         remove_all_filters('swift_performance_prebuild_headers');
  10.     }
  11. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement