Title: PHP Warning: compact(): Undefined variable
Last modified: May 1, 2023

---

# PHP Warning: compact(): Undefined variable

 *  Resolved [dimal](https://wordpress.org/support/users/dimalifragis/)
 * (@dimalifragis)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/)
 * Hello.
 * WordPress 6.2 / PHP 8.0.x and Preloading still doesn’t work. Also my debug.log
   has several of these:
 * [17-Apr-2023 19:07:31 UTC] PHP Warning: compact(): Undefined variable $wp_cache_preload_posts
   in /home/public_html/wp-content/plugins/wp-super-cache/wp-cache.php on line 1175

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Daniel](https://wordpress.org/support/users/ihenetudan/)
 * (@ihenetudan)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/#post-16672790)
 * Hi there,
 * Thank you for reaching out to us regarding the issue you’re experiencing with
   WP Super Cache and PHP 8.0.x. It seems that there is a compatibility issue between
   the plugin and PHP 8.0.x, specifically related to the `compact()` function.
 * As a temporary workaround, you can downgrade your PHP version to 7.4, which should
   resolve the issue with preloading and the PHP warning in your debug.log. However,
   we understand that this is not an ideal solution.
 * Our development team is aware of this issue, but we can’t say exactly when it
   will get fixed. In the meantime, please keep an eye on our plugin’s changelog
   for updates.
 * We apologize for any inconvenience this may cause. If you have any further questions
   or concerns, please don’t hesitate to reach out.
 *  Thread Starter [dimal](https://wordpress.org/support/users/dimalifragis/)
 * (@dimalifragis)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/#post-16673017)
 * Hi, so my preload issue (not working) and the warning are related?
 *  Thread Starter [dimal](https://wordpress.org/support/users/dimalifragis/)
 * (@dimalifragis)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/#post-16674523)
 * PHP 8.0 was released in Nov 2020 and after 3 years WPSC is not compatible with
   it?
 * I can’t believe what a read here.
 *  Thread Starter [dimal](https://wordpress.org/support/users/dimalifragis/)
 * (@dimalifragis)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/#post-16684688)
 * Switched to PHP 7.4.
 * While i don’t see the “compact() Warning”, Preload is still broken. So it is 
   not only an issue of PHP 8.0 but a general issue of preload.
 * Actually Preload was semi working for years but now it doesn’t work at all.
 *  [Bruce (a11n)](https://wordpress.org/support/users/bruceallen/)
 * (@bruceallen)
 * Happiness Engineer
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/#post-16701105)
 * As there are two threads open from you, we’re going to be replying in this one:
   [https://wordpress.org/support/topic/some-issues-from-wpsc-debug/](https://wordpress.org/support/topic/some-issues-from-wpsc-debug/)
   and close this thread.
    -  This reply was modified 3 years, 1 month ago by [Bruce (a11n)](https://wordpress.org/support/users/bruceallen/).
 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/#post-16701125)
 * Closed by Moderator

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘PHP Warning: compact(): Undefined variable’ is closed to new replies.

 * ![](https://ps.w.org/wp-super-cache/assets/icon-256x256.png?rev=3506220)
 * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-super-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-super-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-super-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-super-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-super-cache/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * Last activity: [3 years, 1 month ago](https://wordpress.org/support/topic/php-warning-compact-undefined-variable/#post-16701125)
 * Status: resolved