Title: PHP 8 custom theme update error
Last modified: June 10, 2022

---

# PHP 8 custom theme update error

 *  [scatory2](https://wordpress.org/support/users/scatory2/)
 * (@scatory2)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/php-8-custom-theme-update-error/)
 * After updating site to php and WP 8 I get this warning
 * `Warning: Attempt to read property "cat_ID" on null` and it’s coming from functions.
   php
 * here is the block of code:
 *     ```
       add_action('pre_get_posts', 'pre_get_posts_mod1' ); 
       	function pre_get_posts_mod1( $wp_query ) { 
   
       	$excluded =  get_resource_cat_ids();  
        	//exclude podcast category by ID 
       	array_push($excluded, '9', '1691'); 
   
       	$page_object = get_queried_object(); 
       	$cat_ID = $page_object->cat_ID; 
       	//do we exclude anything from main loop? 
       	if (!in_array( $cat_ID , $excluded )) {
       	//exclude categories
       	set_query_var('category__not_in', $excluded);  
       		}	  
   
        }
       ```
   
 * Stack trace from debug log
 *     ```
       [10-Jun-2022 13:18:20 UTC] PHP Stack trace:
       [10-Jun-2022 13:18:20 UTC] PHP   1. {main}() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-admin/admin-ajax.php:0
       [10-Jun-2022 13:18:20 UTC] PHP   2. require_once() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-admin/admin-ajax.php:22
       [10-Jun-2022 13:18:20 UTC] PHP   3. require_once() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-load.php:50
       [10-Jun-2022 13:18:20 UTC] PHP   4. require_once() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-config.php:92
       [10-Jun-2022 13:18:20 UTC] PHP   5. do_action() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-settings.php:620
       [10-Jun-2022 13:18:20 UTC] PHP   6. WP_Hook->do_action() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/plugin.php:476
       [10-Jun-2022 13:18:20 UTC] PHP   7. WP_Hook->apply_filters() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/class-wp-hook.php:331
       [10-Jun-2022 13:18:20 UTC] PHP   8. wpDiscuzForm->initPersonalDataExporter() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/class-wp-hook.php:307
       [10-Jun-2022 13:18:20 UTC] PHP   9. wpdFormAttr\Tools\PersonalDataExporter::getInstance() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-content/plugins/wpdiscuz/forms/wpDiscuzForm.php:60
       [10-Jun-2022 13:18:20 UTC] PHP  10. wpdFormAttr\Tools\PersonalDataExporter->__construct() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Tools/PersonalDataExporter.php:112
       [10-Jun-2022 13:18:20 UTC] PHP  11. wpdFormAttr\Tools\PersonalDataExporter->initFormsFields() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Tools/PersonalDataExporter.php:16
       [10-Jun-2022 13:18:20 UTC] PHP  12. get_posts() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Tools/PersonalDataExporter.php:21
       [10-Jun-2022 13:18:20 UTC] PHP  13. WP_Query->query() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/post.php:2410
       [10-Jun-2022 13:18:20 UTC] PHP  14. WP_Query->get_posts() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/class-wp-query.php:3586
       [10-Jun-2022 13:18:20 UTC] PHP  15. do_action_ref_array() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/class-wp-query.php:1805
       [10-Jun-2022 13:18:20 UTC] PHP  16. WP_Hook->do_action() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/plugin.php:524
       [10-Jun-2022 13:18:20 UTC] PHP  17. WP_Hook->apply_filters() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/class-wp-hook.php:331
       [10-Jun-2022 13:18:20 UTC] PHP  18. pre_get_posts_mod1() /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-includes/class-wp-hook.php:307
       [10-Jun-2022 13:18:20 UTC] PHP Warning:  Attempt to read property "cat_ID" on null in /Users/jasonsprague/Local Sites/marketsmart-site/app/public/wp-content/themes/imarketsmart/functions.php on line 242
       ```
   

Viewing 1 replies (of 1 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/php-8-custom-theme-update-error/#post-15728718)
 * The error is apparently triggered by an AJAX request that the wpDiscuz plugin
   should process. I would recommend you to contact their support: [https://wordpress.org/support/plugin/wpdiscuz/](https://wordpress.org/support/plugin/wpdiscuz/)

Viewing 1 replies (of 1 total)

The topic ‘PHP 8 custom theme update error’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [threadi](https://wordpress.org/support/users/threadi/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/php-8-custom-theme-update-error/#post-15728718)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
