Title: PHP 8 compatibility
Last modified: September 20, 2022

---

# PHP 8 compatibility

 *  [protohominid](https://wordpress.org/support/users/protohominid/)
 * (@protohominid)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-8-compatibility-68/)
 * I’m testing my site with PHP 8.1 and it seems the LuckyWP Table of Contents plugin
   is throwing a fatal error. When I disable the plugin the site loads normally.
   This is from my debug log with the plugin enabled (server path deleted for security):
 *     ```
       [20-Sep-2022 17:58:16 UTC] PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given in /public_html/wp-includes/class-wp-hook.php:307
       Stack trace:
       #0 /public_html/wp-includes/plugin.php(191): WP_Hook->apply_filters()
       #1 /public_html/wp-content/plugins/luckywp-table-of-contents/front/Front.php(49): apply_filters()
       #2 /public_html/wp-content/plugins/luckywp-table-of-contents/front/Toc.php(305): luckywp\tableOfContents\front\Front->enqueueAssets()
       #3 /public_html/wp-content/plugins/luckywp-table-of-contents/plugin/Shortcode.php(198): luckywp\tableOfContents\front\Toc::render()
       #4 [internal function]: luckywp\tableOfContents\plugin\Shortcode->luckywp\tableOfContents\plugin\{closure}()
       #5 /public_html/wp-content/plugins/luckywp-table-of-contents/plugin/Shortcode.php(199): preg_replace_callback()
       #6 /public_html/wp-includes/class-wp-hook.php(307): luckywp\tableOfContents\plugin\Shortcode->theContent()
       #7 /public_html/wp-includes/plugin.php(191): WP_Hook->apply_filters()
       #8 /public_html/wp-includes/post-template.php(253): apply_filters()
       #9 /public_html/wp-content/themes/nm2021/single.php(17): the_content()
       #10 /public_html/wp-includes/template-loader.php(106): include('/home/...')
       #11 /public_html/wp-blog-header.php(19): require_once('/home/...')
       #12 /public_html/index.php(17): require('/home/...')
       #13 {main}
         thrown in /public_html/wp-includes/class-wp-hook.php on line 307
       ```
   

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

 *  Thread Starter [protohominid](https://wordpress.org/support/users/protohominid/)
 * (@protohominid)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/php-8-compatibility-68/#post-16032466)
 * Answering my own question here…
 * The issue was this function that I had added to my theme’s functions.php file:
 * `add_filter( 'lwptoc_enqueue_style', false );`
 * I was trying to prevent the plugin’s default stylesheet from loading. Does anyone
   know the proper way to do that without angering the php8 gods?
 *  [Colin McDermott](https://wordpress.org/support/users/woodsandhillsplc/)
 * (@woodsandhillsplc)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/php-8-compatibility-68/#post-16146423)
 * Hi, you could try and exclude using a plugin like Asset Cleanup. This is what
   I use.
    -  This reply was modified 3 years, 7 months ago by [Colin McDermott](https://wordpress.org/support/users/woodsandhillsplc/).

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

The topic ‘PHP 8 compatibility’ is closed to new replies.

 * ![](https://ps.w.org/luckywp-table-of-contents/assets/icon-256x256.png?rev=2100677)
 * [LuckyWP Table of Contents](https://wordpress.org/plugins/luckywp-table-of-contents/)
 * [Support Threads](https://wordpress.org/support/plugin/luckywp-table-of-contents/)
 * [Active Topics](https://wordpress.org/support/plugin/luckywp-table-of-contents/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/luckywp-table-of-contents/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/luckywp-table-of-contents/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Colin McDermott](https://wordpress.org/support/users/woodsandhillsplc/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/php-8-compatibility-68/#post-16146423)
 * Status: not resolved